Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Declare @abc varchar(20)
Set @abc ='abc '
Update table set xxx =@abc where ass ='23'
Posted
Comments
Krunal Rohit 3-Apr-14 1:45am    
your ass column is numeric ??

-KR
vanarajranjit 3-Apr-14 2:12am    
S numeric
Member 10641779 3-Apr-14 2:05am    
try this,
Update table set xxx =@abc where ass =23
vanarajranjit 3-Apr-14 2:30am    
That also tried not working
Member 10641779 3-Apr-14 2:40am    
Is 'table', your table name??

1 solution

When you get an error, you normally get an error message as well - and it provides important information as to what problem the system has found with your code. And without that, you make our job a lot, lot harder...

Try this:
SQL
UPDATE [table] SET xxx =@abc WHERE ass ='23'

table is an SQL keyword, so you need to let it know that you mean your table called "table" instead.
 
Share this answer
 
Comments
vanarajranjit 3-Apr-14 3:44am    
It is not updating to the column ..but it shows 1 rows affected.for eg i given table my table is different
OriginalGriff 3-Apr-14 4:28am    
If it's showing one row affected, then it's updating something!
So...how do you know it's not updating the row? how did you check?
(And please - Copy'n'Paste - we need to see exactly what you did, not what you *think* you did. It's far, far to easy to read what you meant to write - I do it all the time!)
vanarajranjit 3-Apr-14 4:46am    
It is updating to others columns but not updating to the specific column
OriginalGriff 3-Apr-14 4:57am    
As I said - how do you know? How did you check? what column is getting updated? Which column(s) should be being updated.
Exactly what code did you use?
Sorry - but we need accuracy here! :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900