SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need Help Please
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rollie
Starting Member

Philippines
4 Posts

Posted - 10/04/2012 :  21:55:50  Show Profile  Reply with Quote
guys, need your help on this please.

I need to update all status into I which is inactive with the given data which is card no only. I am using SQL 2005

table name: Temp
id name card no status
1 Celso 5306722 A
2 andrew 5306724 A
3 albert 5306723 A
4 allan 5306735 A
5 Brian 5306774 A
6 Joseph 5306796 A
7 stephen 5306801 A

here is the result

Celso 5306722 I
Allan 5306735 I
Joseph 5306796 I
Stephen 5306801 I

My Query

Update From Temp
Set Status = 'I'
where card_no = '5306722, 5306735, 5306796, 5306801'

but it doesn't work

Thanks for the help guys.

tkizer
Almighty SQL Goddess

USA
36817 Posts

Posted - 10/05/2012 :  00:50:56  Show Profile  Visit tkizer's Homepage  Reply with Quote
where card_no in (5306722, 5306735, 5306796, 5306801)

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Rollie
Starting Member

Philippines
4 Posts

Posted - 10/05/2012 :  01:29:48  Show Profile  Reply with Quote
Thank you for your reply tkizer but i keep getting this error

Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.

Im using SQL Server Manager Studio Express

Thanks again hope you can help with this.
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2206 Posts

Posted - 10/05/2012 :  01:56:24  Show Profile  Reply with Quote
quote:
Originally posted by Rollie

Thank you for your reply tkizer but i keep getting this error

Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.

Im using SQL Server Manager Studio Express

Thanks again hope you can help with this.



If Card_no is of varchar type, then apply

where card_no in ('5306722', '5306735', '5306796', '5306801')

--
Chandu
Go to Top of Page

Rollie
Starting Member

Philippines
4 Posts

Posted - 10/05/2012 :  02:04:59  Show Profile  Reply with Quote
tkizer:

i figured it out the correct syntax was where card_no in ('5306722', '5306735', '5306796', '5306801')
it work.

Thanks a lot. God bless
Go to Top of Page

Rollie
Starting Member

Philippines
4 Posts

Posted - 10/05/2012 :  02:06:43  Show Profile  Reply with Quote
Thanks bandi your right.
it work already.

Thanks a lot guys.
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2206 Posts

Posted - 10/05/2012 :  02:44:19  Show Profile  Reply with Quote
quote:
Originally posted by Rollie

Thanks bandi your right.
it work already.

Thanks a lot guys.




Welcome

--
Chandu
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
36817 Posts

Posted - 10/05/2012 :  14:43:39  Show Profile  Visit tkizer's Homepage  Reply with Quote
Rollie, why are you using varchar data type for numeric data?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000