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.
| Author |
Topic |
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2008-09-26 : 09:13:56
|
| declare @name varchar(500)declare @ids varchar(20) set @ids='U100000000'if exists (select @name=vastname from login where aid = @ids) print @nameelse print 'Invalid ID' Ved Prakash Jha |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-26 : 09:16:18
|
| [code]declare @name varchar(500)declare @ids varchar(20)set @ids='U100000000'select @name=vastname from login where aid = @idsif @name is not nullprint @nameelseprint 'Invalid ID' [/code] |
 |
|
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2008-09-26 : 09:17:57
|
| Thanks ...Ved Prakash Jha |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-26 : 09:20:16
|
[code]CREATE FUNCTION dbo.fnGetName( @IDs VARCHAR(20))RETURNS VARCHAR(20)ASBEGIN RETURN COALESCE((SELECT TOP 1 VastName FROM Login WHERE aID = @IDs), 'Invalid ID')END[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|