Viewing 15 posts - 391 through 405 (of 416 total)
Whereas:
>= '20140101' AND < '20150101'
continues to work accurately for all those data types.
+1
December 4, 2014 at 9:18 am
BWFC (12/4/2014)
declare @startdate datetime = '2014-12-04'
declare @enddate datetime = '2014-12-05'
create table #EventHeader(
HistoryIDint primary keynot null
,DateTimeHappened datetimenot null
)
insert into #EventHeader
select 100001, '2014-12-01' union all
select 100002,...
December 4, 2014 at 8:42 am
BWFC (12/4/2014)
ScottPletcher (12/3/2014)
BWFC (11/27/2014)
One other thing, be careful using BETWEEN for date range queries. You're usually better using
where
[Date] >= @startdate
and
[Date] <= @enddate
Have a look at...
December 4, 2014 at 7:56 am
Yeah, I've been bitten by text columns when I was unfamiliar with the schema.
December 3, 2014 at 9:05 am
Jeff Moden (10/25/2008)
As soon as something needs to "go in in a hurry", all notions of standards and well intended code reviews will go by the wayside.
+1
December 2, 2014 at 9:24 am
GilaMonster (11/28/2014)
Or stop using SELECT *
+ 1000
December 2, 2014 at 8:26 am
dave.ott 20779 (12/2/2014)
I've always liked this to get the age in yearsselect cast(datediff(d,@dob,getdate())/365.25 as int)
This has problems on birthdays. As listed, the code returns 0 when dob = '12/2/2013'...
December 2, 2014 at 8:20 am
Unfortunately, this is legal ANSI/ISO Standard SQL so it has to work. But you ought to get a warning!
Rather than defaulting to "1," maybe they could make it work like...
December 1, 2014 at 2:22 pm
Hugo Kornelis (11/26/2014)
The code in option 2 will always do two lookups. One for the EXISTS, and then another one for...
November 26, 2014 at 9:53 am
peter.row (11/26/2014)
You say you have an identity column, you add 4 rows and want to add a 5th.
Since this is a...
November 26, 2014 at 9:50 am
Koen Verbeeck (11/20/2014)
I'd argue ROWCOUNT_BIG is an odd one as well, as it is not calculated over the current result set, but over the results of a previous query.
+1
Also, ROWCOUNT_BIG...
November 20, 2014 at 9:10 am
Yep, incomplete information in the question. I'm surprised it got past the gatekeeper(s).
November 14, 2014 at 7:51 am
Since it's a one column key, you can put the constraint on the column definition:
CREATE TABLE [dbo].[#ShipTo]
([Ship_to_Num] [int] not null PRIMARY KEY CLUSTERED,
[Country_key] [nvarchar](3) NULL)
November 12, 2014 at 1:45 pm
MMartin1 (11/5/2014)
... surrogate keys are a data warehouse concept and not in the operational data system ...
Actually, this is not correct. E.F. Codd introduced the concept of surrogate keys...
November 6, 2014 at 2:03 pm
Viewing 15 posts - 391 through 405 (of 416 total)