Re: Formatting Dates

From: Wayne Snyder (wayne.nospam.snyder_at_mariner-usa.com)
Date: 06/30/04


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
>
>
>
>


Relevant Pages

  • Re: Unable to Apply SP4 to SQL 2000 Cluster (new Node)
    ... Rebuild the node in the failover cluster. ... Scenario 1" in SQL Server 2000 Books Online. ... This setup process updates to SP4 only the binaries on the new ...
    (microsoft.public.sqlserver.clustering)
  • Re: WSS 3.0 question
    ... I followed the advise given in removing WSS 3.0 etc, ... the server is complaining that the SQL service(?) was tempered with or corrupt. ... I may just instal the SQL server as I was going eventuall use it anyway. ... If WSUS 3.0 is installed, I would suggest you uninstall it and then you install WSS 3.0. ...
    (microsoft.public.windows.server.sbs)
  • Re: SQL Server 2005 Cluster Setup Quiz
    ... I did test and it did not install the client tools. ... http://www.clusterhelp.com - Cluster Training ... Microsoft SQL Server MVP ... Provide a template on how to read SQL Server 2005 setup log files. ...
    (microsoft.public.sqlserver.clustering)
  • Re: WSUS
    ... I'm not seeing performance issues with the full enchilada installed, and 25 users busy hitting SQL. ... WSUS isn't difficult to uninstall - if you have WSUS v2 (installed with SBS R2) uninstall R2 from add/remove programs. ... How can anyone work with 4 instances of SQL Server on the same box? ...
    (microsoft.public.windows.server.sbs)
  • Re: Cannot setup SQL Mail on SBS 2003
    ... Microsoft CSS Online Newsgroup Support ... Cannot setup SQL Mail on SBS 2003 ... The account you use to start the SQL Server service must be a domain ...
    (microsoft.public.windows.server.sbs)