Home > Archive > MS SQL Server > November 2006 > Date Conversion









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Date Conversion
amatuer

2006-11-10, 5:15 am

code:

SET @Yr = 1986
Set @Datum = '1/1/' & @Yr


Hi, I am experiencing a problem with the "Set @Datum " statement. Does
anyone know how would I use the cast function to convert this, " '1/1/'

& @Yr " to be put into my DateTime var,@Datum?


Thanx.

Tibor Karaszi

2006-11-10, 5:15 am

See my reply to your other post. No need to post the same question in three threads.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/



"amatuer" <njoosub@gmail.com> wrote in message
news:1163143392.775333.101750@h48g2000cwc.googlegroups.com...
> code:
>
> SET @Yr = 1986
> Set @Datum = '1/1/' & @Yr
>
>
> Hi, I am experiencing a problem with the "Set @Datum " statement. Does
> anyone know how would I use the cast function to convert this, " '1/1/'
>
> & @Yr " to be put into my DateTime var,@Datum?
>
>
> Thanx.
>


vt

2006-11-10, 5:15 am

try this

SET @Yr = 1986
Set @Datum = '1/1/' + cast( @Yr as varchar)

vt



"amatuer" <njoosub@gmail.com> wrote in message
news:1163143392.775333.101750@h48g2000cwc.googlegroups.com...
> code:
>
> SET @Yr = 1986
> Set @Datum = '1/1/' & @Yr
>
>
> Hi, I am experiencing a problem with the "Set @Datum " statement. Does
> anyone know how would I use the cast function to convert this, " '1/1/'
>
> & @Yr " to be put into my DateTime var,@Datum?
>
>
> Thanx.
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com