.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

Collect The coloums Name from Table by store proc

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

How I can Collect Coloums Namee from table by passing the table name in Parameter.

View Complete Post

More Related Resource Links

How can I avoid error a Insert Store proc if he don't find any coloum in a table


I have created one Insert Proc for a table which has three Colourm. 

Id int, [Name] varchar (30), Phone varchar (15) I want to use this proc for another Table which has two coloum which is semiler with first table lie   Id int, [Name] varchar (30) I want to use one Insert Store Proc For two Table. I can avoid null value of parameter but but can't avoid if the coloum is not exist. 



Reading data to a table from a stored proc

This has me brain locked.  1. I've got a stored procedure.  2. It does a select with a couple joins.  I want to take the results of that stored proc and read them into some a table -- temp table would be ideal.  here's my (really tough) constraints... these really complicate things: 1. the stored proc uses dynamic SQL. As a consequence, I don't know the columns it's going to return (it's kind of the whole point of using it).  2. Since the stored proc uses dynamic SQL, it needs to use sp_executesql internally.    What won't work(i don't think?): 1. I can't create a function that returns a table and does a "return select * from....", since you can't (I don't think?) call a stored a stored proc in the return statement of a function 2. I can't just do an "Insert into #xyz exec .." because I can't pre-define the temp table (I think this is needed?). 3. I don't have a linked server. and i'd rather not. All of this runs local in the same instance of SqlServer, and will have to handle loads of volume (each hit will return a few million rows).  So (I think?) OPENQUERY  is out.  4. OPENROWSET is a possibility, I suppose, but again, everything is running locally. I think that goes through OLEDB (?) and I'm not sure that's even an option.    THOUGHTS???  HELP?? is it even possible?? Pl

Create store Procedure for select Table by Passing Table Name In Parametere

I want to create a Procudure to Select all Information in Table Like (select * from TableName) but Condition is I do not want to Mention The Fix Table Name I will send the Table Name In a parameter from My Vb.net Project like This (select * from @Parameter ) and Then The Select Procudure work with on That Table. It will be change depend on my vb.net reqierment I already Created a Procudure But it Does not working. It is in below. alter proc AllSelect (@Table varchar (30)) as DECLARE @sql nvarchar(MAX) SET @sql = ' Select * from '+@Table+' ' If possible Please let me know also Update and Delete proc by same way. with Regards Suman Bangladesh

How To Create Dynamic Insert Store Proc


I want to Create a Insert Procedure for Table which has Three Coloum I want to use this Insert Store Proc for another table which has two coloum. If it works then I don't Have to create more Store Proc for Every Table One Insert Proc will Serve my Purpose I am My giving my proc below

Create Proc All_Insert


@Name varchar (30),

@Phone varchar (15)

@Mobile Varchar (15)





insert into Table1














How I can Create update Proc for Multipul Table by Id


How I can Create update Proc for Multipul  Table by Id . I will send the Table Name In parameter from my Vb.net Project which Table I need to Update. I am Giving the Sample in Below but it does not working

Help me regarding This Mattter

alter Proc Catagory_Update



@Table varchar (30),

@Name varchar (30),

@Id int





@sql nvarchar(MAX)


@sql = 'Update '+@Table+

'Set ([Name] = @Name)

where id = @id'


sp_executesql @SQL,N'@Name Varchar(30),@id int',@Name,@id



share data in two table using store procedure


i want to update one table columns using 2nd table value like this:

ALTER procedure [dbo].[INS_Profile_intotempfrommaster_delete ]
@UserID int

select @OrgnisationLink=OrgnisationLink,@F_Name=F_Name,@L_Name=L_Name,@EmailID=EmailID,@EncryptedEmailID=EncryptedEmailID,@Address=Address,@City=City,@State=State,@Pincode=Pincode,@Designation=Designation,@P_Number=P_Number,@M_Number=M_Number,@OrgnisationProfile=OrgnisationProfile
from t_usermaster where UserID=@UserID

update t_usermaster_mirror
set OrgnisationLink=@OrgnisationLink,F_Name=@F_Name,L_Name=@L_Name,EmailID=@EmailID,EncryptedEmailID=@EncryptedEmailID,Address=@Address,City=@City,State=@State,Pincode=@Pincode,Designation=@Designation,P_Number=@P_Number,M_Number=@M_Number,OrgnisationProfile=@OrgnisationProfile


but i am getting error

Exception Details: System.Data.SqlClient.SqlException: Procedure or Function 'INS_Profile_intotempfrommaster_delete ' expects parameter '@OrgnisationLink', which was not supplied.

plz reply me how can i do this

How to grab ip address of remote connection to store in table


Hey guys move if in wrong area


I am trying to create a bit of a VPN program using sql server.

I have figured out how to have a form grab the users ip address and port from a tcp connection and store it into a table.

Now I want to integrate this directly into the sql server.

I know you can filter connections by IP using login triggers but is there a way to do the same when a command is issued to the database.

How To Store Task Start Time and Task End Time in log table using SSIS?


Hi All,


Present my log table storing each task functionality  Same log table in that  I want store every task start time and end time also. How to implement this in ssis?





Slow Store proc



can someone pls help me! I have a sql query that runs 8 seconds but it takes more than 20min when i put that query in a store proc. what could be the cause of this? I tried taking the same query and put it in a SSRS 2008 Dataset and see if it will return anything, It runs for ever!


reindex table through proc or c#?



I have a table with two indexes, PK_WClient (clustered) and SMonths (non-unqiue, non-clustered), we have a data import that works on the .net side, it imports data via C# into the table. Every time we complete the import the sections of the asp.net site that use that table are very slow, just when pulling the new records, old records are fine. so we reindex that table for both indexes and things are fine again. Rather than us having to reindex manually in sql server 2005 each time, is there a way to get this to happen via a stored proc or from the c# side? this way when the client gets the project, we don't need to run the index, they can just use the site to import data and behind the sceens the reindex can happen once the import is done.


Store and retrive data from a temp table



I want to create a temp table to store data in a stored procedure and then then retrive it from the code.
I need to save the data in the begining before it is deleted.And then after the inserts are done I want to update the tblcontactlist by referring to the temp table.

Can someone help me with this please?


Private Sub btnAssign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAssign.Click
        Dim bUpdate As Boolean = True

            Dim strSql As String
            Dim strSql1 As String
            Dim dr As SqlDataReader

            'delete exist CIM Employees
            strSql = "delete from tblBNIContactList where companyid=" & txtCompanyid.Text

            'Assign Employee
            Dim i As Integer
            For i = 0 To lbxSelectedEmployees.Items.Count - 1
                strSql = "insert into tblContactList(CompanyID, IssuePrefix, UserID, PM, DevMgr, AltIncAllCorr) values("
                strSql &= cboCompanyName.SelectedValue & ",'" & txtIssuePrefix.Text & "', '" & lbxSelectedEmployees.Items(i).Value & "', 0, 0, 0)"


SQL Server 2005 - How to Call One Store Proc from Other Store Proc ?


Hi ,

I have a Requirment, How can I called One Store Procedure from Other Store Procedure ?

After Calling to Other Store Proc, How can i Store that other Store Proc Result Sets in the Temp Table, So i can process in the Current Store Proc Result Sets ?



How to upload a file to web server in asp.net and store file path into database table?

This article describe how to upload a file into web server folder using asp.net file upload control and store the file information into sql server database.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Insert value using Table Value Functions

a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

Using jQuery to Filter Table Rows

The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

RadioButton Groups, Table Rows And NamingContainers in asp.net

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.
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