Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 13, 2013 06:38 AM by anilr499
Member
94 Points
389 Posts
Feb 13, 2013 05:32 AM|LINK
hi
how to insert a string into a column of data type date
here i need to insert manually 'Last Quarter' into 'week_date' column which is of datatype 'date' eg:
select 'Last Quarter' as week_date , '3.00' as kp,'Blue' as col union all
select week_date,kpi_tw,CASE WHEN KP > '3' THEN 'Green' when kp = '3' then 'Blue' when kp < '3' then 'Red' else 'Orange' end as col from MU
error: Conversion failed when converting date and/or time from character string.
thank you
Participant
1402 Points
272 Posts
Feb 13, 2013 06:12 AM|LINK
use cast(week_date as varchar)
becuase u will not be able to convert 'last quarter' in to date.
on UI u can change accordingly
Feb 13, 2013 06:38 AM|LINK
thank you....i did as u said...:)
anilr499
Member
94 Points
389 Posts
how to insert a string into a column of data type date
Feb 13, 2013 05:32 AM|LINK
hi
how to insert a string into a column of data type date
here i need to insert manually 'Last Quarter' into 'week_date' column which is of datatype 'date'
eg:
select 'Last Quarter' as week_date , '3.00' as kp,'Blue' as col union all
select week_date,kpi_tw,CASE WHEN KP > '3' THEN 'Green'
when kp = '3' then 'Blue'
when kp < '3' then 'Red' else 'Orange'
end as col from MU
error:
Conversion failed when converting date and/or time from character string.
thank you
sumitjain231
Participant
1402 Points
272 Posts
Re: how to insert a string into a column of data type date
Feb 13, 2013 06:12 AM|LINK
use cast(week_date as varchar)
becuase u will not be able to convert 'last quarter' in to date.
on UI u can change accordingly
Remember to click Mark as Answer on the post that helps to others.
anilr499
Member
94 Points
389 Posts
Re: how to insert a string into a column of data type date
Feb 13, 2013 06:38 AM|LINK
hi
sumitjain231
thank you....i did as u said...:)