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
 General SQL Server Forums
 New to SQL Server Programming
 declare and set the variable

Author  Topic 

gagani
Posting Yak Master

112 Posts

Posted - 2012-08-31 : 06:19:11
in the stored procedure, i have input variable which stores
the name 'mark scott' .
but i have to alter the name for my search criteria.
can anyone declare a variable
and store the name in such a way that it stores 'scott mark' in
temporary variable

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-08-31 : 06:40:19
[code]
declare @name varchar(100)

select @name = 'mark scott'
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-31 : 10:04:20
if sql 2008 or later versions you can simplify above as

declare @name varchar(100)='mark scott'

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -