July 7, 2009 at 3:31 am
I have this query here:
SELECT
top 10 left((convert(varchar(10), D_Date, 120)), 13) D_DateValue,
(replace(convert(varchar(10), D_Date, 120), '-', '')) D_DateID
FROM
D_DATE
What does "left" represent?, "120" represent?, and the second line "Replace"
Kind Regards
Hasani
July 7, 2009 at 3:45 am
Break it down to its component parts
ie
Start with
select convert(varchar(255), D_Date, 120)
then
Select convert(varchar(10), D_Date, 120)
then
Select left((convert(varchar(10), D_Date, 120)), 13)
Which is slightly bizzare , taking the left 13 characters of a varchar(10).
Use Bol (Books on line)as your primary resource the functions are all well documented
July 7, 2009 at 3:50 am
Hi,
Left is an inbuilt function that returns left part a string starting from 0 and upto the length specified (13 in your case).
Replace is another inbuilt string function that will replace a subset of string with another say ',' with ';'.
and convert function for datetime is well documented which returns datetime in various formats as specified by the code (120 in your case
which return 'yyyy-mm-dd hh:MM:ss' format) .
You can also refer Books Online for details.
Hope that helps
July 7, 2009 at 3:51 am
Hi
Thank you very much, can you send me one useful link where I can able to download some T-SQL ebook?
Kind Regards
Pitso
July 7, 2009 at 4:07 am
July 7, 2009 at 5:34 am
Any suggestion on specific ebook to use
July 7, 2009 at 6:21 am
Hi,
This looks helpful. Thanks alot.
cool:
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply