all groups > sql server mseq > february 2006 >
You're in the

sql server mseq

group:

support for bind variables?


support for bind variables? G_Allen
2/27/2006 10:15:14 AM
sql server mseq:
I recently did a little development on an Oracle database and utilized bind
variables in a script like this:

SELECT first_name, last_name, zip FROM customers WHERE id = :cust_no

and simply defined ":cust_no" as a parameter through my application code. I
found this statement in an Oracle discussion:

"Support for bind variables isn't just limited to Oracle - it's common to
other RDBMS platforms such as Microsoft SQL Server..."

but can't find anything to corroborate it in SQL Server support. How do I
Re: support for bind variables? David Portas
3/4/2006 3:19:36 PM
[quoted text, click to view]


Well firstly why wouldn't you want to create a stored proc? In SQL Server it
is best practice to perform ALL data access through stored procs unless you
have a special reason not to. Procs have so many advantages that are just
too numerous to go into in full: better security, performance, scalability,
ease of maintenance, version control, etc, etc.

The following are examples of passing parameters in .NET both with and
without procs:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingstoredprocedureswithcommand.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingparameterswithdataadapters.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconinputoutputparametersreturnvalues.asp

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

AddThis Social Bookmark Button