Viewing 15 posts - 631 through 645 (of 1,491 total)
As you seem to be using SQL2012, why not use a SEQUENCE instead of an IDENTITY?
February 18, 2016 at 5:34 am
If your formulas are really that secret, the only way I can think of protecting them is to keep them on your own secure servers. Your customers could then do...
February 18, 2016 at 5:13 am
I suspect all the joins in the sub-query will not do the query plan much good.
It will probably be best to create a temp table with all the IDs to...
February 13, 2016 at 3:11 pm
You may find the Word document referenced here to be useful:
https://msdn.microsoft.com/en-us/library/dn673537.aspx
Please note, I have played with this a bit but not used it in anger as we do not have...
February 11, 2016 at 9:10 am
IF (@date IS NULL)
SET @day = (SELECT MAX(day1) FROM table1 WHERE date1 = (SELECT MAX(date1) FROM table1));
ELSE
SET @day = (SELECT MAX(day1) FROM table1 WHERE date1 = @date);
February 9, 2016 at 5:18 am
Just query the backup tables in MSDB.
eg Something like the following will get the logs since the last full backup.
SELECT 'RESTORE LOG YourDBRestore FROM DISK =''' + M.physical_device_name + '''...
January 28, 2016 at 2:06 pm
Try something like:
WITH RNs
AS
(
SELECT *
,-ROW_NUMBER() OVER (ORDER BY <WhatEverYouWant>) AS rn
FROM YourTable
WHERE YourPK IS NULL
)
UPDATE RNs
SET YourPK = rn;
January 26, 2016 at 2:22 pm
As backups are not always done from the SQL Agent, your can also check for backups by looking at MSDB.
Try playing with the following script for FULL and LOG backups.
Ideally...
January 26, 2016 at 10:29 am
Our upgrade policy tends to be driven by Micorsoft's support cycle rather than new features.
(ie It is relatively easy to get money for an upgrade if we say the old...
January 25, 2016 at 7:32 am
Using Orlando's test data, maybe:
WITH Groups
AS
(
SELECT ID, Measure
,ROW_NUMBER() OVER (ORDER BY ID)
- ROW_NUMBER() OVER (PARTITION BY Measure ORDER BY ID) AS Grp
FROM dbo.SomeMeasurement
)
,GroupOrders
AS
(
SELECT *
,ROW_NUMBER() OVER (PARTITION BY Measure, Grp...
January 15, 2016 at 5:32 am
I think LEAD has been in Oracle for sometime.
Something like:
SELECT *
,LEAD(SMN_DATEC, 1) OVER (PARTITION BY DET_NUMBERA ORDER BY SMN_DATEC) - 1 AS EndDate
FROM CHRISCS_EMSAL
ORDER BY DET_NUMBERA, SMN_DATEC;
January 14, 2016 at 9:07 am
I suspect 18GBytes for the maximum memory would be a better place to start although heuristics for this tend to vary quite a bit.
I have only ever used trial and...
December 16, 2015 at 9:08 am
This looks remarkably similar to:
December 16, 2015 at 8:46 am
I would look at the basics first.
1. Is there anything else other than your SQL2008R2 instance on the server?
2. Is the server a VM?
3. Does the maximum memory in your...
December 16, 2015 at 5:44 am
A test harness with DDL etc would be useful.
As this is a database why not create:
CREATE TABLE Entities
(
[Group] char(3) NOT NULL
,[Type] char(3) NOT NULL
CONSTRAINT PK_Entities PRIMARY KEY ([Group], [Type])
);
INSERT INTO...
December 11, 2015 at 6:15 am
Viewing 15 posts - 631 through 645 (of 1,491 total)