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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 calling a stored procedure

Author  Topic 

chedderslam
Posting Yak Master

223 Posts

Posted - 2008-06-10 : 16:32:50
I understand how to call a stored procedure using ordinal arguments, such as:

exec storedprocedure argument1 argument2

How do you do it while naming the arguments, and passing non-ordinal?

Thanks!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-06-10 : 16:33:53
Just use the parameter names. You can then pass them in any order.

DECLARE @p1 int, @p2 varchar(10)

SET @p1 = 1, @p2 = 'tkizer'

EXEC sp1 @someparameter2 = @p2, @someparameter1 = @p1

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

chedderslam
Posting Yak Master

223 Posts

Posted - 2008-06-10 : 16:44:57
That's what I was looking for. Thanks
Go to Top of Page
   

- Advertisement -