Viewing 15 posts - 2,191 through 2,205 (of 8,731 total)
Don't take unnecessary shortcuts when writing queries. Keep them clear and simple.
You seem to be trying to create a query that would allow to search on every column, instead of...
September 2, 2016 at 1:17 pm
I pointed to that article because if you share the details mentioned in there, it would give us an idea of what's happening. Without details, we're just guessing.
On the index...
September 2, 2016 at 1:11 pm
Can you share your solution?
I didn't use a cross join, I used a cross apply which is different.
September 2, 2016 at 11:44 am
Index seeks are not always the best option, especially when they're accompanied by a key lookup. Sometimes, an index scan is better when a wide range of rows is selected.
Please...
September 2, 2016 at 8:04 am
Maybe this could help.
CREATE TABLE Customers( id int, Point Geography);
INSERT INTO Customers
SELECT 1, geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326);
CREATE TABLE Stores( id int, Point Geography);
INSERT INTO Stores
SELECT 1, geography::STGeomFromText('POINT(-125.34900 47.65100)', 4326) UNION ALL
SELECT...
September 2, 2016 at 7:30 am
Lynn Pettis (9/1/2016)
ScottPletcher (9/1/2016)
Luis Cazares (9/1/2016)
drew.allen (9/1/2016)
First, the mantra is "It's a bad idea to declare a cursor. Period. End of sentence." 😀Drew
Second, cursors can be local or global and...
September 1, 2016 at 1:57 pm
Lynn Pettis (9/1/2016)
djj (9/1/2016)
Sean Lange (9/1/2016)
Lynn Pettis (9/1/2016)
And his forced vacation from SSC did nothing to motivate White Horse from his berating ways. Who let him back in?
Odd...I can't...
September 1, 2016 at 1:46 pm
Here's an option, you need to complete the last column.
UPDATE A
SET ACTION1= CASE WHEN A.ACTION1 IS NULL THEN B.ACTION ELSE A.ACTION1 END,
ACTION2= CASE WHEN A.ACTION1 IS...
September 1, 2016 at 1:42 pm
This smells like RBAR. That would certainly be slow.
If you post DDL for your table and indexes, along with the UPDATE process we could give better advice on what to...
September 1, 2016 at 1:33 pm
Maybe this can give you an idea.
CREATE TABLE Test( id int);
DECLARE @SQL NVARCHAR(1000) = 'DROP TABLE Test;';
EXEC( 'SET NOEXEC ON; ' + @SQL);
SELECT * FROM Test;
DROP TABLE Test;
EDIT: Changed PARSEONLY...
September 1, 2016 at 1:00 pm
Why do you want to create a column with unique values to create a unique index on it? What do you expect to achieve?
September 1, 2016 at 12:40 pm
drew.allen (9/1/2016)
First, the mantra is "It's a bad idea to declare a cursor. Period. End of sentence." 😀Drew
Second, cursors can be local or global and the default is defined by...
September 1, 2016 at 12:31 pm
Iwas Bornready (9/1/2016)
Derek Slinn (9/1/2016)
Both are stored in tempdb database.
technically table variables can just be in memory if there is only a small amount of...
September 1, 2016 at 8:35 am
You should pay attention to what Drew is saying. Right now, the business rules might say that you'll only have 3 actions on each item, but later, you'll be able...
September 1, 2016 at 6:30 am
You don't, you use 24 hours.
So, these are AM:
'2016-08-30 08:00:00.000'
'2016-08-30 11:59:59.997'
And these are PM:
'2016-08-30 20:00:00.000'
'2016-08-30 23:59:59.997'
Also, you need to take in account that seconds will always be zero(:00) for smalldatetime...
August 31, 2016 at 10:59 am
Viewing 15 posts - 2,191 through 2,205 (of 8,731 total)