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
 SQL Server Development (2000)
 Error

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-04-20 : 15:49:54
[code]
I am using below query

SET @errmsg = 'Error while loading student table' + case @SQLVersion when 0 then '' else error_message() end

When executed i got below error

Server: Msg 195, Level 15, State 10, Line 264
'error_message' is not a recognized function name.
[/code]

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-20 : 15:52:25
Are you using SQL Server 2000 or 2005? ERROR_MESSAGE is not available in 2000.

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-04-20 : 15:54:06
What Tara said. Unless you have a user defined function named error_message. Then I think you need to prefix it with the owner, for example: dbo.error_message().
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-04-20 : 15:57:21
It's working fine in 2005 when trying to execute the same in 2000 got the error.
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-04-20 : 15:59:52
What is the function which i can use instead of ERROR_MESSAGE in sql 2000..
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-20 : 17:48:01
Well what are you trying to achieve? Perhaps you need @@ERROR.

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-04-20 : 21:37:24
I got it.

Thanks for your help.
Go to Top of Page
   

- Advertisement -