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 2000 Forums
 Transact-SQL (2000)
 default values in stored procedure

Author  Topic 

dejjan
Yak Posting Veteran

99 Posts

Posted - 2005-04-04 : 09:07:49
Hello,
I have a problem with default values in stored procedure.

Create procedure Archiving
(
@archiver_path varchar(150) = 'C:\Program Files\WinRAR\',
@database_name varchar(50),
@to_archive tinyint = 1
)
as
Print @archiver_path
Print @database_name
Print @to_archive


How could I call my procedure with values:
@archiver_path = 'C:\Program Files\WinRAR\',
@database_name = 'Northwind'
@to_archive = 1,
by using default values.

If my procedure doesn't have @database_name, it would be easy:
exec Archiving
and result would be:
C:\Program Files\WinRAR 1

I hope you will understand.



nr
SQLTeam MVY

12543 Posts

Posted - 2005-04-04 : 09:22:39
exec Archiving @database_name = 'Northwind'

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-04 : 10:02:06
You can also try

exec Archiving default, 'Northwind', default
Go to Top of Page

dejjan
Yak Posting Veteran

99 Posts

Posted - 2005-04-05 : 03:05:09
Thanks guys
Go to Top of Page
   

- Advertisement -