May 25, 2004 at 8:41 am
Being newish to SQL Server I hope someone can help.
In a table I store dates as integers. I access this table from a view, when I list the date fields they are integers, is there anyway in the view that you can convert the Date fields as dates??
May 25, 2004 at 9:28 am
In your view change the select for the column you want changed to
cast( <column> as datetime)
May 25, 2004 at 9:30 am
Sure, just create the VIEW with an expression for you date column data. However, you will not be able to UPDATE the "date" data using this VIEW. (Maybe see TRIGGERs - INSTEAD OF, in BOL, for updating values through the VIEW itself.)
Once you understand the BITs, all the pieces come together
May 25, 2004 at 11:28 am
Post examples of how your dates currently look. That will help us come up with a way to convert them to DATETIME.
-SQLBill
May 26, 2004 at 2:03 am
Using the cast command within the view worked.
Thanks for all your help.
Kevin
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply