Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to pass hashtable to store procedure.

Author  Topic 

hspatil31
Posting Yak Master

182 Posts

Posted - 2013-12-17 : 02:46:25
Dear All,

I have following hash table in C#.
Rank Slug
1 ABC
2 XYZ
3 PQR

I want to pass hash table or data table to the store procedure and use the looping inside the store procedure.

Can anyone please help how to do above scenario ?

Thanks and Regard's
Harish Patil

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2013-12-17 : 02:50:42
You can either pass it as XML or as a Table Valued Parameter. For the TVP, you will need to create a TYPE in SQL and use that type as the input, there are a few constraints, but if you can work with them, it is the faster way to pass a table.

See http://msdn.microsoft.com/en-us/library/bb675163(v=vs.110).aspx for more detail on how to go about this.
Go to Top of Page

hspatil31
Posting Yak Master

182 Posts

Posted - 2013-12-17 : 05:01:26
Thanks RickD. Your post is helpful.

Thanks and Regard's
Harish Patil
Go to Top of Page
   

- Advertisement -