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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is convert function bidirectional 1

Status
Not open for further replies.

tektipdjango

IS-IT--Management
Jan 28, 2004
188
it's unclear for me if convert function is used from datetime to string only or also the opposite way.
Can anyone help me
Thank's inadvance

--------------------------------------------------
[highlight]Django[/highlight] [thumbsup]
bug exterminator
tips'n tricks addict
 
It can go either way.

Code:
SELECT CONVERT(DATETIME, '4/2/2004'),
       CONVERT(VARCHAR(20), GETDATE, 121)

-SQLBill
 
Forgot to add that it can also be used for other conversions...

Code:
DECLARE @var1 CHAR(2)
SET @var1 = '12'
DECLARE @var2 INT
SET @var2 = 34
SELECT CONVERT(INT, @var1),
       CONVERT(DECIMAL(3,1), @var1),
       CONVERT(CHAR(2), @var2)

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top