Viewing 15 posts - 811 through 825 (of 1,491 total)
Master.dbo.spt_values is alright for quick queries but for production code I would be inclinded to generate a Numbers table in the relevant DB.
November 23, 2010 at 8:03 am
WHERE N.type = 'P' AND N.number BETWEEN 0 AND 29
November 22, 2010 at 8:30 am
It is best to search on a range so that there are no functions on J.JobTimeStamp, making it SARGable:
-- either
SELECT DATEADD(d, DATEDIFF(d, 0, CURRENT_TIMESTAMP), - N.number) AS MissingDate
FROM [master].dbo.spt_values N
WHERE...
November 22, 2010 at 5:08 am
Given your table definition, this should generate some usable test data:
SELECT TOP (100)
'UNION ALL SELECT '
+ CAST(ID AS varchar(20)) + ' AS ID,'
+ CAST(MainID AS varchar(20)) + ' AS MainID,'
+...
November 16, 2010 at 10:54 am
C# Screw (11/5/2010)
simply locking the row would have been fine.
This I could do in my FoxPro days, but in SQL it seems that at least a page locked.
For example...
November 5, 2010 at 12:25 pm
Here is a CLR function which could be used in Sergiy's code:
http://www.pluralsight-training.net/community/blogs/dan/archive/2006/07/27/32597.aspx
or if the operators are simple enough, just use the XML capability.
November 5, 2010 at 7:21 am
WHERE ColumnA LIKE
CASE
WHEN @Type = 'TWO' THEN N'%' + N' 20-' + N'%'
ELSE N'%' + N' [3-4]0-' + N'%'
END
November 2, 2010 at 10:38 am
GSquared (10/28/2010)
Not a good plan. What if you end up with concurrent inserts both picking 12 as the next value? Then both succeed.
It is a very good plan...
October 29, 2010 at 3:31 am
The following gives an example of the sort of code you need to be careful with:
http://en.wikipedia.org/wiki/Snapshot_isolation
As a concrete example, imagine V1 and V2 are two balances held by a single...
October 28, 2010 at 10:31 am
While snapshot isolation can be very useful, you should google 'write skew anomolies', check your code and do a lot of testing.
October 28, 2010 at 10:00 am
The classic way around this is to add a nonclustered index for the FK check to use.
Something like the following should work:
ALTER TABLE test1
ADD CONSTRAINT uq_test1 UNIQUE NONCLUSTERED (a)
October 28, 2010 at 9:50 am
ady.foot7970 (10/27/2010)
I want to limit the number of Cartwall titles to 12 and this need a trigger to enforce this in the database.
You can enforce this without triggers by...
October 28, 2010 at 8:51 am
October 21, 2010 at 8:33 am
UPDATE generatepk WITH (UPDLOCK)
SET ...
may help, especially if you are using SNAPSHOT isolation.
October 20, 2010 at 8:37 am
Ouch!
One cursor in a trigger is bad enough, but three!
Also, two of your cursors are not being closed correctly and I doubt
if SUBSTRING(CONVERT(VARCHAR(30),CONVERT(DATETIME,@vtimetablestartfrom),110),1,3) = SUBSTRING(@SWV_NEW_DAY,1,3)
will work as it looks as...
October 18, 2010 at 9:40 am
Viewing 15 posts - 811 through 825 (of 1,491 total)