Viewing 15 posts - 1,186 through 1,200 (of 3,348 total)
First, in SQL Server CASE is not a statement but an expression. That means that "when section=reading and value =start then time as start_Time" in itself will already throw a...
January 7, 2016 at 4:19 pm
If every row in PARTB has at least one match in PROVIDER_IN, you can also use:
UPDATE dbo.PARTB
SET PROV_NBR = ( SELECT TOP (1) p.PROV_NBR
...
January 7, 2016 at 4:09 pm
GilaMonster (1/7/2016)
KGJ-Dev (1/7/2016)
I am struggling to make it where to put like operator and where to put '%' at the end
The = should have been a LIKE, sorry about...
January 7, 2016 at 12:38 pm
Hugo Kornelis (1/7/2016)
Rune Bivrin (1/7/2016)
January 7, 2016 at 12:10 pm
How about something like the below:
SELECT Customer, ContractStart, ContractEnd,
CASE WHEN ContractEnd = MAX(ContractEnd) OVER (PARTITION BY Customer) THEN 1 ELSE 0 END
FROM YourTable;
The MAX() OVER (PARTITION BY)...
January 7, 2016 at 12:05 pm
The short answer is to replace <<expression>> with T2.Code
The longer and better answer is to warn you about the weird behaviour of UPDATE FROM when there is no strict 1-to-1...
January 7, 2016 at 11:56 am
Ah okay, I missed the detail that the updated column is indexed.
I did some digging (and some experiments with DBCC IND and DBCC PAGE - always fun!) and I now...
January 7, 2016 at 10:23 am
Tallboy (1/7/2016)
Your right, but every row from the source table could and will have different dates , therefor I need to use a cursor to iterate over them! ...
January 7, 2016 at 10:05 am
Once you enable snapshot isolation, SQL Server will add an extra invisible column to all tables. This column is a pointer to the version store. For committed data, this pointer...
January 7, 2016 at 5:28 am
Yes, but you'll have to do some smart scripting to pull it off. The trick would be to have the file name for the backup generated such that it will...
January 7, 2016 at 5:20 am
Since you already have a calendar table, generating the rows to be inserted should be easy with a join:
INSERT INTO dbo.Appointments (column list)
SELECT s.ClientID, c.Date, other, columns
FROM dbo.SourceTable AS s
INNER...
January 7, 2016 at 5:14 am
Since we cannot change the laws of physics and are unlikely to get the world to accept an alternate calendar/clock system that does not align with daylight and seasons, the...
January 7, 2016 at 5:08 am
For performance, I would capture the creative query with ROW_NUMBER in a temporary table, add a (clustered, nonunique) index on the row_number, and then copy the data to the new...
January 7, 2016 at 5:01 am
I like the question, but there are two small caveats.
First is that I would have liked the answer to be phrased as "10 in all 10 rows" or something equivalent,...
January 7, 2016 at 4:55 am
Rune Bivrin (1/7/2016)
Interestingly enough, the most recent docs for COUNT() states that the OVER() requires the ORDER BY clause, which is patently untrue, at least up to SQL 2012....
Good discovery!...
January 7, 2016 at 4:47 am
Viewing 15 posts - 1,186 through 1,200 (of 3,348 total)