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)
 Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-02 : 08:00:25
Madhavi writes "I need to write a stored procedure to check the input parameter passed to SP is a numeric or non numeric. How to check this. please help me

I have tried in this way.. But it doesn't work

create proc isNumeric( @param varchar(60)) is
begin

declare @num decimal(20,10)
set @num= convert(decimal, @param)
if @@error = 0
return 1
else
return 0
end"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-03-02 : 08:00:58
Why are you creating a procedure named IsNumeric when there is already a built-in function with the same name, that does exactly what you want?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-03-02 : 08:09:45
IsNumeric is a bit rubbish though Rob.

Welcome to SQL Team Madhavi!

I did post one here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=59049

although from people's followups you'll see its not perfect!

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-02 : 08:18:04
Also refer this
http://aspfaq.com/show.asp?id=2390

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -