Re: Formatting Dates
From: Wayne Snyder (wayne.nospam.snyder_at_mariner-usa.com)
Date: 06/30/04
- Next message: Wayne Snyder: "Re: Truly daft question."
- Previous message: jack.lee: "Re: SmallMoney DataType"
- Maybe in reply to: anonymous_at_discussions.microsoft.com: "Formatting Dates"
- Next in thread: Aaron [SQL Server MVP]: "Re: Formatting Dates"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 30 Jun 2004 08:47:09 -0400
In addition to Jacco's comments, IF you use one of the convert functions in
your where clause, SQL will NOT be able to use index statistics during
optimization, and will use estimates ( for equality it will first use
density, then 10%)...
You will get the correct answer, but the optimizer may choose a 'less than
optimal' index.... Be sure to test your queries and check the indices being
used... You'll probably be ok, but if performance gets bad when you add
convert, etc... that may be the reason.
-- Wayne Snyder, MCDBA, SQL Server MVP Mariner, Charlotte, NC www.mariner-usa.com (Please respond only to the newsgroups.) I support the Professional Association of SQL Server (PASS) and it's community of SQL Server professionals. www.sqlpass.org "sh0t2bts" <sh0t2bts@hotmail.com> wrote in message news:%23R1EblpXEHA.716@TK2MSFTNGP11.phx.gbl... > Hi Guys, > > I placed a post last night asking for help with regards to importing data > from an Informix server, Thank You I received the required advise and can > now import my data, this has now lead to a second problem for me, I am using > the below Statement to import data each morning for the previous day:- > Select * > > FROM root.dagent dagent > > WHERE (dagent.acd='2') AND (dagent.row_date = '06/29/2004') > > Order By ti_auxtime desc > > This works fine but I want to schedule this and use the GetDate()-1 function > to specify the date each morning when it runs BUT It errors again with > "unspecified Error" > > I am using this statement > > Select * > > FROM root.dagent dagent > > WHERE (dagent.acd='2') > AND (dagent.row_date = CONVERT(char(12), GETDATE()-1, 101)) > > Order By ti_auxtime desc > > The convert part "CONVERT(char(12), GETDATE()-1, 101)" returns the date > formatted as "mm/dd/yyyy" which is what is required to get the statement to > work, > > > > has anyone got any ideas on what else I could try? > > > > Many Thanks > > > > Mark > > > >
- Next message: Wayne Snyder: "Re: Truly daft question."
- Previous message: jack.lee: "Re: SmallMoney DataType"
- Maybe in reply to: anonymous_at_discussions.microsoft.com: "Formatting Dates"
- Next in thread: Aaron [SQL Server MVP]: "Re: Formatting Dates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|