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)
 Putting a variable in Raiserror

Author  Topic 

pareshmotiwala
Constraint Violating Yak Guru

323 Posts

Posted - 2003-02-13 : 14:45:26
I would like to put a variable in the error message, for a trigger.
The variable is host_name().
I tried different stuff but nothing seems to work...
Any ideas?

tfountain
Constraint Violating Yak Guru

491 Posts

Posted - 2003-02-13 : 15:00:26
You can only use variables in a raiserror statement. You'll need to store the information from HOST_NAME() into a variable and then do something like so:

RAISERROR('Hey ''%s'', you crashed the database!', 15, 1, @HostName)

Go to Top of Page

pareshmotiwala
Constraint Violating Yak Guru

323 Posts

Posted - 2003-02-13 : 15:20:17
Thanks, it worked.

Go to Top of Page
   

- Advertisement -