Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cast function

Status
Not open for further replies.

b00gieman

Programmer
Jul 9, 2007
60
DE
Hi!

Is it possible to update the content of a column from a table(smalldatetime) with nvarchar data using CAST? The nvarchar string is mm/dd/yyyy and so is the date format
 
Don't see why not! Something like:
Code:
SET DATEFORMAT MDY
UPDATE MyTable SET DateField = CAST(VarCharField AS datetime)

SQL should treat the slashes as a valid date delimiter and the SET DATEFORMAT will ensure correct interpretation of US date format.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top