Solved

SQL Server Stored Procedures and Transaction Questions

Posted on 2007-11-21
3
562 Views
Last Modified: 2008-02-02
Hello Experts!
Stored Procedures:
Is it possible to pass an array of parameters object directly to a stored procedure? I mean I don;t want to pass each parameter individualy, but pass a single array containing all pre-configured paramentes to the stored procedure.
I would like to see an example using C#.

Transactions:
The SqlTransaction object has the IsolationLevel property. I understand perfectly the ReadUncomminted, ReadComminted, RepeatableRead and Serializable isolation levels, but I have no idea about what the Unspecified level is. When, how and what for is it used?

Thanks!
0
Comment
Question by:andrepires
3 Comments
 
LVL 18

Accepted Solution

by:
Yveau earned 167 total points
ID: 20330658
Stored Procedures:
No, there is not an array type in SQL Server. Alternatives is passing a parameter of type table or passing a string like: 'parm1=value1, parm2=value2, ...'

Transactions:
... unspecified is probably the 'use whatever the server is using at this moment, don't worry about it, just run the SQL code!' option. Not sure on this one ...

Hope this helps ...
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 167 total points
ID: 20332544
>Is it possible to pass an array of parameters object directly to a stored procedure?
Eventhough there is no array datatype, we can pass those values as CSV (Comma separated values). The logic should be implemented inside the sp to handle these.


0
 
LVL 12

Assisted Solution

by:kselvia
kselvia earned 166 total points
ID: 20337177
Here are a couple of examples of using csv values as stores procedure arguments

http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm#top

http://www.sommarskog.se/arrays-in-sql-2005.html
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now