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 |
|
shapper
Constraint Violating Yak Guru
450 Posts |
Posted - 2007-03-09 : 20:27:32
|
| Hello,I have a table where two of the columns are BoxId (UniqueIdentifier) and BoxName (NVarchar). I need to change the BoxName given the BoxName:@BoxName NVARCHAR(200),@NewBoxName NVARCHAR(200),@Feedback INT OUTPUTASBEGINSET NOCOUNT ONIF EXISTS (SELECT * FROM dbo.Boxes WHERE LOWER(BoxName) = LOWER(@BoxName))BEGINUPDATE dbo.BoxesSET BoxName = @NewBoxName,WHERE LOWER(BoxName) = LOWER(@BoxName)SELECT @Feedback = @@ERRORENDMy question is, can I "rename" the box name and at the same time use the BoxName to select the record?Thanks,Miguel |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-09 : 20:58:39
|
| You mean the way you are doing it in update? Yes, it is allowed. Also, if you don't have case-sensitive collation, you can get rid of LOWER() in the WHERE clause.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-09 : 21:38:32
|
Yes. Is it not working as expected ? KH |
 |
|
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2007-03-13 : 00:19:49
|
| i dont think u need to use thisIF EXISTS (SELECT * FROM dbo.Boxes WHERE LOWER(BoxName) = LOWER(@BoxName))mk_garg |
 |
|
|
|
|
|