.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Creating function in all databases using dynamic sql

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :Sql Server


We have to create a stored procedure which runs in SQL 2000. The swtored procedure has to take a database name as input paramaeter and then it has to create a scalar valued function in the input database. Following is the query i'm using but it's creatin in on the current database only not on the input database.


SET @SQL2='CREATE function dbo.fn_C (@string1 varchar(15))
 returns varchar(15)
  --Manipulation steps

    RETURN @string2

Even I tried to merge use db statement before create function, but it's throwing an error saying 'create function has to be the first parameter'

Please suggest how can I acheive the functionality by modifying the stored procedure.

Thanks in dvance.

View Complete Post

More Related Resource Links

Dynamic .NET: Creating Interactive Bing Maps with Silverlight and IronRuby


Silverlight provides support for dynamic languages such as IronRuby and IronPython. We'll walk you through the creation of a custom Silverlight control using Bing Maps and IronRuby.

Ashish Ghoda

MSDN Magazine February 2010

Design Patterns: Creating Dynamic Factories in .NET Using Reflection


Design patterns are a powerful tool for designing flexible soft-ware. They provide well-tested solutions to recurring software design problems. One such widely used pattern is the Concrete Factory.

Romi Kovacs

MSDN Magazine March 2003

Creating Web Databases with Access 2010 and Access Services (Visual How To)

Watch the video and explore code as you learn how to create an Access 2010 Web database and publish it to Access Services on SharePoint Server 2010.

Sample: Creating Web Databases with Access 2010 and Access Services

Explore the code in this visual how-to article as you learn how to create an Access 2010 Web database and publish it to Access Services on SharePoint Server 2010.

Video: Creating Web Databases with Access 2010 and Access Services

Create an Access 2010 Web database and publish it to SharePoint Server 2010 by using Access Services. (Length: 7:45)

dynamic creating controls in webpart


Hello everybody,


My webpart (wss 3.0, VS2005) initialy contain a listbox. Depeding on the selection made a certain amount of textboxes are to be created and rendered. Via these dynamically created / rendered textboxes text can be submitted (via a button), for futher processing.


I am not sure how, or where in the webpart code, to dynamically create these textboxes.


Maybe somebody can give me some advise on this topic.


Thanks in advance









Help with creating dynamic XAML

Hi,  I need some help creating a complex XAML. I have a HotelRoom table with the below fields, ID Hotel HotelName Date RoomType Quantity  1    34    Hilton        3/5     Single      30  2    34    Hilton        3/6     Single      30  3    34    Hilton        3/7    Double     100  4    39    Express     3/5     King         10  5    39    Express     3/6    Double      20 Now I want the UI to display as a list of different records of Hotels with room details in them and I have created an object that has all the fields from the HotelRoom table,   HILTON               Single     Double    3/5        30          0    3/6 &n

Re;Creating Dynamic Control

Hi, I have a table which stores the data like mentioned below ID Name Values 1 States Karnataka,Tamilnade,AP,UP 2 Karnataka Bangalore, Mysore, Bidar 3 tamilnadu Salem,Chennai,Pondicherry 4 AP Hyderbad,Secunderabad,Vishakapatanam 5 UP Delhi,Agra Now i have to create a dynamic controls for each and every states from the above table. A Sate Name should be dispalyed with checkbox on check of checkbox i have to enable all the cities which is again associated with the checkbox.How do i simulate this functionality using dynamic checkbox and labels. Please help me with a sample code.

Creating a table-valued function on a user defined type in SQL Server CLR

We would like to be able to create a table-valued function on a user defined type.  We would like the syntax in SQL to look like it works for the XML nodes function:   DECLARE @myXml XML = '<a><b>1</b><b>2</b><b>3</b></a>' ; SELECT  node.query('text()') FROM    @myXml.nodes('a/b') nodes (node) ;   In other words, in the FROM clause, we can access the "nodes" method of the xml variable and it returns a rowset. Thanks!

Creating Code Function or Assemblies to manipulate Dataset

Folks In SSRS the dataset, can it be send to a Code function for further manipulation of the data ? For example, In SSRS I have a Column of Data and I want to passed it to a Code Function, and the code function for certain values and perform some Engineering calculation, and the function than return a modififed dataset. Can I do this ? Thanks in Advance  

Browse Button - Creating Mailbox Databases

Hey, Another question.  I have installed exchange 2010 as per the guide.  One issue I experience is When I try creating a new Mailbox Database, it does not give me the browse button to create the database on another drive. Should there be one, even though the instructions  says to Click the Browse button to select the drive where I want the database to reside? Thanks in advance Andrew  

Creating Dynamic Group Fields for a Crystal Report?

I have a VB.Net application which generates quite a few Crystal Reports. One report in particular has a Group Section. What I am trying to do with my VB.Net app is pass a value (a sql server column name used in the report). This value is represented by radio buttons. For example, the user may check either "ZipCode" or "State" or "Category" or "Type" or "Vendor". Each of these options represent a column in the database table used in the report. I simply want to be able to write the "SelectionFormula" using one of these options but not sure how to go about it. Thanks, Blake

Cannot call Table Valued Function from Dynamic stored procedure statement

Hello,  I have a table-valued function that splits string into a table column. I can easily call this function from a stored procedure within a regular SELECT statement: SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM [dbo].[fnSplitValues](@Code2String))   However when I try to use the same logic for a dynamic SELECT statement: ‘SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM ' + [dbo].[fnSplitValues](@Code2String) + ')’ I get an error ‘Cannot find either column "dbo" or the user-defined function or aggregate "dbo.fnSplitValues", or the name is ambiguous.’ Any idea what is wrong with my dynamic SQL?   Please help, Lana

Creating dynamic template columns in gridview

how to create dynamic template columns in gridview  . I have writing some of the code but it gives me error The type or namespace name 'GridViewLabelTemplatecould' not be found (are you missing a using directive or an assembly reference?)    I have paste some my code /con.Open();        string strsql = "select ID,CompanyName from tblcompany";               SqlCommand cmd = new SqlCommand();        cmd.CommandType = CommandType.Text;        cmd.CommandText = strsql;        cmd.Connection = con;        SqlDataAdapter adpt = new SqlDataAdapter();        adpt.SelectCommand = cmd;        adpt.Fill(dt);        GridView1.Columns.Clear();        for (int i = 0; i < dt.Columns.Count; i++)        {            TemplateField tf = new TemplateField();            // create the data rows       

Creating dynamic Tab Control in SharePoint


Hello Every one

I have to create dynamic TAB control which display relivance as tabs using jQuery.

Thank you



Customize Live Search.

creating dynamic mini representation of the Active directory tree.

First of all I would like to thank Dunnry for the great output he has provided to almost any post in this forum. I see he has helped almost all of. Also the link with the vb.net web resources he has provided in some of his posts is great. Now I know how to pretty much do anything I need for my project, except one last thing.

In my web interface with active directory I would like to create a represantation of the active directory tree. I would like a user to be able to click on one OU and then get all the child OU listed under that OU and (etc). At the end he/she would be able to create a user in the final OU. I first thought that would not be such a big deal I could use a bunch of nested datagrids or datarepeaters and the result would look like somewhat real structure of active directory. I already built an array and then populated with the names and bounded to a datagrid, just to see if it works, it does. I spent hours online looking for some information or ideas, but I could not find anything. All I found is one javascript, I have not had time to look at the code, but I doubt it that it is server based. I could use the datagrids and repeaters, but the problem is that our tree is huge and different containers have different number of children. It sounds insane to have for example five nested datagrids I don't even want to think about all the code I woul

Creating a dynamic site using custom template programmatically.



I have sites like




I have created Project1 as Template (Save as Template) and this template is available at http://kashyap Site Gallery > Solutions

http://kashyap/Team has a list called projects. I want to do custom workflow which is run by user manually(It is not problem). I want to create site programmatically  based on the template. I did some code Its

 private void codeCreateSite_ExecuteCode(object sender, EventArgs e)
      SPWeb web = workflowProperties.Web;

      SPListItem lst = workflowProperties.Item;
      string title = lst["Project Title"].ToString();
      string url = Common.UrlString(title);
      string desc = "Project from " + Common.GetFormatedValue(Convert.ToString(lst["Customer"
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend