显示标签为“differences”的博文。显示所有博文
显示标签为“differences”的博文。显示所有博文

2012年3月8日星期四

Any significant differences between these two date CAST statements

I need to find records that have a date stamp of yesterday. I have created two where clauses that use CAST and DATETIME. Both seem to return the same results. Is either one better?

CAST(FLOOR(CAST(cc.Date AS float)) AS datetime) = CAST(FLOOR(CAST((getdate()-1) AS float)) AS datetime)

-- OR --

cast (round(cast(cc.Date as float),0,1) as datetime) = cast (round(cast((getdate()-1) as float),0,1) as datetime)

BTW: Oracle handles this easily as trunc(mydate)

Thanks in advance

Oh Using SQLServer 2005

Doug

www.cooltimbers.com

It looks to me like they will both work:

declare @.morningDt datetime set @.morningDt = '3/13/7 0:05'
declare @.afternoonDt datetime set @.afternoonDt = '3/13/7 23:59'

select cast(round(cast(@.morningDt as float),0,1) as datetime),
cast(round(cast(@.afternoonDt as float),0,1) as datetime),
round(cast(@.morningDt as float),0,1) ,
round(cast(@.afternoonDt as float),0,1)

-- -- - -
2007-03-13 00:00:00.000 2007-03-13 00:00:00.000 39152.0 39152.0

I am more used to seeing the FLOOR version.

|||

Thanks Kent for the prompt reply... and for your help in general!

I sure do wish Microsoft implements something similar to Oracles "TRUNC" function that nicely truncates to a day.

2012年2月25日星期六

Any issues with SP2 and 2005 x64?

I came across someone who mentioned in passing that there are lots of issues
with SP2 and x64, is that true? Are there any significant differences to be
aware of between SP2 on x32 vs x64?
TIA
Michael MacGregor
Database ArchitectMost of my clients run SP2 on X64 with no problem. I would rather run on SP2
than SP1.
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Michael MacGregor" <macnoknifespam@.noemailspam.com> wrote in message
news:Ot3z3zaFIHA.3548@.TK2MSFTNGP06.phx.gbl...
>I came across someone who mentioned in passing that there are lots of
>issues with SP2 and x64, is that true? Are there any significant
>differences to be aware of between SP2 on x32 vs x64?
> TIA
> Michael MacGregor
> Database Architect
>|||Thanks Andrew.
MTM

2012年2月13日星期一

any article regarding differences between SQL2K and Yukon

any article regarding differences between SQL2K and YukonThere is almost none public info on Yukon yet, as those who has access to it are under
non-disclosure agreements. Your best bet it probably to search the net and try to find out what has
"leaked" until now.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Hassan" <fatima_ja@.hotmail.com> wrote in message news:upjwehGgDHA.944@.TK2MSFTNGP11.phx.gbl...
>|||Of the information that has been made public, the biggest change appears to
be the ability to write stored procs, UDF's and triggers using any .NET
language. This could potentially alter, drastically, how coding is done at
the database level. T-SQL is also being beefed up significantly.
J.R.
Largo SQL Tools
The Finest Collection of SQL Tools Available
http://www.largosqltools.com
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:upjwehGgDHA.944@.TK2MSFTNGP11.phx.gbl...
>|||> language. This could potentially alter, drastically, how coding is done
at
> the database level.
I guess the key is 'could potentially'. Some other DBMSs have introduced
similar features. As far as I can tell from working with DBAs of those
products, the database level coding doesn't seem to have been altered that
drastically. Perhaps, it's just the DBA crowd I hang out with :-)
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Largo SQL Tools" <nospam@.yahoo.com> wrote in message
news:u0jRvfHgDHA.3616@.TK2MSFTNGP11.phx.gbl...
> Of the information that has been made public, the biggest change appears
to
> be the ability to write stored procs, UDF's and triggers using any .NET
> language. This could potentially alter, drastically, how coding is done
at
> the database level. T-SQL is also being beefed up significantly.
> J.R.
> Largo SQL Tools
> The Finest Collection of SQL Tools Available
> http://www.largosqltools.com
> "Hassan" <fatima_ja@.hotmail.com> wrote in message
> news:upjwehGgDHA.944@.TK2MSFTNGP11.phx.gbl...
> >
> >
>

2012年2月11日星期六

ANSI-Style Joins & Old-Style Joins!

I came across an article which states the differences between
ANSI-style JOINs & old-style JOINs. This was one among them:
---
The ANSI-style JOIN supports query constructions which the old-style
JOIN syntax does not support.
---
What does the above mean especially the term "query constructions"?
Thanks,
ArpanOne example is that the old-style syntax only directly supports joins
based on equality. In the ANSI syntax we can write:
SELECT *
FROM A
LEFT OUTER JOIN B
ON A.col1 BETWEEN B.col2 AND B.col3
To do that without the OUTER JOIN operator would require an inner join
and a UNION.
David Portas
SQL Server MVP
--|||The *= syntax was equality only and a table could appear only once as
eitehr preserved or unpreserved. Google aroudn for one of my olds
postings on how the outer works|||On 30 Jul 2005 01:38:32 -0700, Arpan wrote:

>I came across an article which states the differences between
>ANSI-style JOINs & old-style JOINs. This was one among them:
>---
>The ANSI-style JOIN supports query constructions which the old-style
>JOIN syntax does not support.
>---
>What does the above mean especially the term "query constructions"?
>Thanks,
>Arpan
Hi Arpan,
In addition to the answers provided by David and Celko, here are two
more examples:
1. The ANSI-style permits you to write
SELECT something
FROM A
LEFT OUTER JOIN B
ON B.col1 = A.col1
AND B.col2 IS NULL
or
SELECT something
FROM A
LEFT OUTER JOIN B
ON B.col1 = A.col1
WHERE B.col2 IS NULL
And the results of these two are quite different. With the old-style
joins, they'd be the same:
SELECT something
FROM A, B
WHERE B.col1 =* A.col1
AND B.col2 IS NULL
And which of the two possible result sets you'd get depends on how the
programmers decided to implement this. From what I've heard, Oracle's
result set would be different from SQL Server's.
2. FULL OUTER JOIN. This is not available in old-style.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

2012年2月9日星期四

Ansi Sql 87

What are the differences between ANSI SQL 87 and 92. I searched through google ,didn't find any documents on this . Could you please point out to any websites .
I need the sample queries covering most of the syntaxes on ANSI SQL 87 .
Thanks
Reddythere aren't any web sites for sql 87

may i ask why you need this? what is it for?