SQLTeam.com | Weblogs | Forums

Concat suffix in sql task varible value


#1

Hi Team,

I want to concat some predefined values during insert from sql task.below is my script.

insert into test(id, values)
values(?,?+'mark')

i created two variables and want to insert first variable value in first column that is happening correctly and wanted to insert variable+'mark' in second but there is some error occurred.

Please help me resolve.


#2

you need to make close the column name with square bracket


#3

I don't think you can do string manipulation WITHIN a VALUES() statement?

If that is the case you would need:

insert into test(id, values)
SELECT ?,?+'mark'

using SELECT instead of VALUES

not withstanding that "values" is a reserved word, as Waterduck has said, so you might need to quote its name

insert into test(id, [values])
SELECT ?,?+'mark'

#4

sry for the typo, i want to insert data in name column. the problem is actually when i want to add some suffix in variable that i want to pass in execute sql task.
insert into test(id, name)
values(?,?+'mark')


#5

Did my suggestion not work?


#6

no it didn't work.


#7

Error message?