Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, I got error when I'm tryi

Status
Not open for further replies.

wuwang

Programmer
May 16, 2001
48
US
Hello,

I got error when I'm trying to put the character statement in SELECT statement (I just want to show the DELETE record statment) like below:

select 'DELETE table WHERE table_ID = ' + table_id
from table
where table_id in (1234, xxxxx,xxxxx)

How can I resolve this problem. Thank you for your help
in advance.
 
Hiya,

Exactly what error are you getting? I have tried your code and it works fine on my system.

Tim
 
Since datatype of table_id is int.
I need to use Convert function to transfer the id as varchar and it works.

Thank you again.
 
you can do
declare @xxx varchar(500)
set @xxx = 'DELETE table WHERE table_ID = '
select @xxx + table_id ..... John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top