Hi,
I have to write a "dynamic" query
I have a table (FINWEEK) containing dates and the corresponding internal On this table I want to look up the weeknr by using this query: That works, I now want to do the following query: I tried decalring the GETDATE() as a variable but I cannot put it into a Thanks in advance, EdV
financial weeknr.
So: DATE, WEEKNR;
1/10,49;1/11,49;1/12,49;1/13,50;1/14,50;1/15,50;1/16,50;1/17,50;1/18,50;1/1
,50;1/20,51;1/21,51
select WEEKNR from datweeknr.dbo.finweek where DATE = '1-11-2002'
select WEEKNR from datweeknr.dbo.finweek where DATE = 'GETDATE()'
but this gives me the reply MM-DD-YYYY HH-MM-SS
I need a reply MM-DD-YYYY, is there any way to do this?
substring, any easier solution?