I have fields that are listed as nvarchar in a table. Field1 contains
the month, Field2 contains the day, Field3 contains the year.
I need to pick stuff off this table with a "date" >= 12/10/2004.
How do you construct the "date" from the 3 fields above?
I've tried cast & converts on it, but have not hit the correct combination.
Any help appreciated.
BCBlasting,
Try:
SELECT <COLUMNS>
FROM <TABLE>
WHERE CAST(CAST(FIELD3+FIELD2+FIELD1 AS CHAR(8)) AS DATETIME) <
ETDATE() -- OR OTHER DATE
HTH
Jerry
"Blasting Cap" <goober@.christian.net> wrote in message
news:uWQkDUl1FHA.1028@.TK2MSFTNGP12.phx.gbl...
>I have fields that are listed as nvarchar in a table. Field1 contains the
>month, Field2 contains the day, Field3 contains the year.
> I need to pick stuff off this table with a "date" >= 12/10/2004.
> How do you construct the "date" from the 3 fields above?
> I've tried cast & converts on it, but have not hit the correct
> combination.
> Any help appreciated.
> BC
>|||concatenate and add '/' between the fields and convert the whole thing to a
datetime
http://sqlservercode.blogspot.com/
"Blasting Cap" wrote:
> I have fields that are listed as nvarchar in a table. Field1 contains
> the month, Field2 contains the day, Field3 contains the year.
> I need to pick stuff off this table with a "date" >= 12/10/2004.
> How do you construct the "date" from the 3 fields above?
> I've tried cast & converts on it, but have not hit the correct combination
.
> Any help appreciated.
> BC
>
Showing posts with label pick. Show all posts
Showing posts with label pick. Show all posts
Saturday, February 25, 2012
Friday, February 24, 2012
datepart
I'm pretty new to this VB Scripting, I'm building a webpage where I'd like to be able to pick out month, day or year from a date variable, I understand this can be done by the datepart function, but it seems like I need to include a certain file or something to make it work?
It generates error '800a0005' when I try to run the code as below
It generates error '800a0005' when I try to run the code as below
d=datepart(mm,date)
You are asking in the wrong forum!!
Subscribe to:
Posts (Atom)