September 22, 2016 at 3:03 pm
Hi Experts ,
i need to insert below input_value into table
input_value is:
'select cc_key ,'+ cast(@min_id as varchar(5)) + ',count(cc_key)cnt,''FAIL'' from cc_model_range_2_1 group by cc_key , created_date
having created_date between '''+cast(@from_dt as varchar(10))+''' and '''+cast(@expt_dt as varchar(10))+''' and cc_key = '''+@cc_key+''' and count(cc_key) > 1'
ex :
table creation :
create table ##multiple_code_values_insertion (raw_value nvarchar(max))
select * from ##multiple_code_values_insertion
try to insert into table :
insert into ##multiple_code_values_insertion values
('
'select cc_key ,'+ cast(@min_id as varchar(5)) + ',count(cc_key)cnt,''FAIL'' from cc_model_range_2_1 group by cc_key , created_date
having created_date between '''+cast(@from_dt as varchar(10))+''' and '''+cast(@expt_dt as varchar(10))+''' and cc_key = '''+@cc_key+''' and count(cc_key) > 1'
')
September 22, 2016 at 3:21 pm
Do you want to store that expression or the results of evaluating that expression? If the first, then you're missing some single quotes. If the latter, then you have too many single quotes.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
September 22, 2016 at 6:11 pm
Dear drew.allen ,
I am going to save expression only.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply