Viewing 15 posts - 826 through 840 (of 1,496 total)
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
You could try comparing the nvarchar string to the string cast as varchar.
DECLARE @str1 nvarchar(20)
,@str2 nvarchar(20)
SELECT @str1 = N'AB' + NCHAR(12354) + N'CD'
,@str2 = N'ABCD'
IF @str1 <> CAST(@str1 AS varchar(20))
PRINT...
October 18, 2010 at 6:05 am
You can use the group by order difference technique to get the ranges followed by the stuff xml technique to roll them up.
-- *** Test data in comsumable format ***
--...
October 14, 2010 at 9:41 am
I am glad the order difference technique worked but unfortunately I cannot claim credit for the idea. The technique was used to win a competition but I cannot remember the...
October 7, 2010 at 3:57 am
I have just had time to look at this again.
To allow for when a book is not on loan try using a numbers/tally table.
(I am just generating the numbers table...
October 6, 2010 at 11:05 am
I think the order difference technique should work well here.
Try the following and let me know how it performs:
;WITH BLOrderDif
AS
(
SELECT *
,ROW_NUMBER() OVER (PARTITION BY BookID ORDER BY LoanDate)
- ROW_NUMBER()...
October 6, 2010 at 10:05 am
-- *** Test data in consumable format ***
-- You will get quicker results if you provide this
CREATE TABLE #t
(
Cust_ID char(15) NOT NULL
,[Year] smallint NOT NULL
,[Month] tinyint NOT NULL
)
INSERT INTO #t
SELECT...
October 6, 2010 at 7:21 am
Also, the trunc and sysdate functions suggest this is an ORACLE query.
October 6, 2010 at 7:04 am
Does this work?
SELECT *
FROM X
WHERE HistoryID = MAX(HistoryID) OVER (PARTITION BY [ObjID])
September 16, 2010 at 4:52 am
I would look at using both.
ie Filestream for files greater than 1MB and varbinary(MAX) for the rest.
I would also put the table with the varbinary(MAX) column into it's own file/filegroup.
August 25, 2010 at 10:02 am
Steve - thanks a lot for your help.
When I copied the files to another server and tried to restore there was no problem.
I then tried on the new server and...
August 24, 2010 at 11:32 am
Viewing 15 posts - 826 through 840 (of 1,496 total)