Viewing 15 posts - 16 through 30 (of 37 total)
I forgot to meantion that datatype of MY_DATE_COLUMN should have been datetime ,for the code below I'm getting the result in the right format..ie but the column MY_DATE_COLUMN has...
November 20, 2012 at 12:53 pm
You are right..thank u
November 20, 2012 at 12:28 pm
David,
Thanks for your help.
This thread was created for concatenating 2 derived columns..if you read the subject of my previous thread ,its something else.
Thanks
SM
November 20, 2012 at 11:42 am
Thank you again Patrick,..I got what I was looking for..:-)
November 20, 2012 at 11:10 am
I tried concatenting the derived columns using +' '+, unfortunately it gives error
SELECT
CASE WHEN I353_DATE_TRANSACTION > 19000000 AND I353_DATE_TRANSACTION < 21000000 THEN
CONVERT(VARCHAR(12),
CONVERT(DATETIME,CONVERT(VARCHAR,CONVERT(INT,I353_DATE_TRANSACTION)))
,101)
ELSE '01/01/1900'
END DATE +' '+SUBSTRING(CONVERT(VARCHAR(12),1000000 + [I353_TIME_TRANSACTION]),2,2)...
November 20, 2012 at 11:06 am
the code is as follows
SELECT
CASE WHEN I353_DATE_TRANSACTION > 19000000 AND I353_DATE_TRANSACTION < 21000000 THEN
CONVERT(VARCHAR(12),
CONVERT(DATETIME,CONVERT(VARCHAR,CONVERT(INT,I353_DATE_TRANSACTION)))
,101)
ELSE '01/01/1900'
END AS DATE,
SUBSTRING(CONVERT(VARCHAR(12),1000000 + [I353_TIME_TRANSACTION]),2,2) + ':' +
...
November 20, 2012 at 10:58 am
ok..Will keep that in mind
November 20, 2012 at 10:40 am
Thank u for the tip 🙂
November 20, 2012 at 10:18 am
Patrick,
Thank you one more time for bailing me out.Even this works perfectly like the one you gave before.
Thnx
Swarup
November 20, 2012 at 10:12 am
Patick,
One small doubt.I have to concatenate one more time_column to this date_column.
This time column is also defined as a decimal ,I'm sure even its code is gonna be similar to...
November 20, 2012 at 9:34 am
Patrick,
Thanks Buddy..you are the man ..the code worked like a charm.Can't thank you enough,I have been beating my head to solve this.
Regards
Swarup
November 20, 2012 at 9:17 am
Splendid Patrick,
That is what I was looking for, Only thing is the out put is in YYYY-MM-DD format , how can I change it to MM/DD/YYYY..and the out is NEW_DATE_COLUMN
2012-09-10...
November 20, 2012 at 8:51 am
I have broken down the reqs into 3 parts
1)Cast decimal as string ( which I did)
select convert(varchar,convert(decimal(8,0),[I353_DATE_TRANSACTION]))
from [stgFACTS].[dbo].[I353_SalesOrder]
2), parse into the format specified(which is MM/DD/YYYY....I don’t know how...
November 20, 2012 at 8:23 am
in the above code the date column is [I353_DATE_TRANSACTION]
November 20, 2012 at 8:16 am
I have deleted a lot of columns names..while pasting it ..
November 20, 2012 at 8:14 am
Viewing 15 posts - 16 through 30 (of 37 total)