dbTalk Databases Forums  

Stored Procudure for searching a string in a column

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Stored Procudure for searching a string in a column in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
lann
 
Posts: n/a

Default Stored Procudure for searching a string in a column - 03-13-2009 , 03:04 AM






Hi I am a SQL new bie.
I searched the forum but couldn't find an exact match of my requirements.
Apologies if I had created a new thread for an existing discussion

I have a table Customer.In customer table I have a column LoginID nvarchar
(225).
I would like to have a SQL stored procedure to check whether the entered
Login already exists in the LoginID column.
If not i like to give the user some message directing to register.
Please help.


Reply With Quote
  #2  
Old   
Russell Fields
 
Posts: n/a

Default Re: Stored Procudure for searching a string in a column - 03-13-2009 , 06:32 AM






Iann,

For example:
DECLARE @NewLoginID NVARCHAR(225)

SET @NewLoginID = 'Fred'

IF EXISTS (SELECT * FROM Customer WHERE LoginID = @NewLoginID)
-- Do whatever you want to give the user a message
ELSE
-- Process the new customer

RLF

"lann" <u50349@uwe> wrote

Quote:
Hi I am a SQL new bie.
I searched the forum but couldn't find an exact match of my requirements.
Apologies if I had created a new thread for an existing discussion

I have a table Customer.In customer table I have a column LoginID nvarchar
(225).
I would like to have a SQL stored procedure to check whether the entered
Login already exists in the LoginID column.
If not i like to give the user some message directing to register.
Please help.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.