Viewing 15 posts - 391 through 405 (of 1,468 total)
Darnit Jeff
Where does you mind go to come up with such perlers?
November 29, 2019 at 4:38 am
This sounds like a good use for rownumber() over (partition by … order by …)
But how do you persist the numbers already used?
If you use a SEQ object, SQL...
November 28, 2019 at 2:17 pm
You have not given us much to work with.
Here is a generic pattern that should get you started
DECLARE @StartDate date = '2019-11-02';
DECLARE @EndDate date =...
November 28, 2019 at 2:06 pm
Considering that you only have 4 digits for your number, I am assuming that this is a low volume system.
In that light, you could use a watermark table to create...
November 27, 2019 at 8:12 pm
Your code will replace "Test" with "Dev" in the ServerType column for the entire table.
If you wish to only do the update where Company is "Blue", then you need to...
November 27, 2019 at 6:58 am
SSC has an article by Sean Smith with code for playing Battleships in SSMS
November 20, 2019 at 2:50 pm
Try this on for size
DECLARE @FormType varchar(50); -- Adjust data type and size to match [f1] + [f2] + [f3]
SET @FormType = ISNULL( (SELECT FormType = ltrim(RTRIM(ISNULL(f1,'')+ISNULL(f2,'')+ISNULL(f3,'')))
...
November 20, 2019 at 3:44 am
I suppose a code sample for the Dynamic SQL might help
DECLARE
@Eid ...
November 19, 2019 at 9:07 pm
This is a classic Catch-All query.
November 19, 2019 at 6:47 pm
All of those UNIONs are creating an insane query plan.
The following code will produce almost the same result, with a MUCH better query plan.
DECLARE @options int =...
November 14, 2019 at 10:02 am
IF (SELECT count(emp.name) FROM **** WHERE *** IN (***)) > 0
BEGIN
SELECT 1;
END;
ELSE
BEGIN
SELECT 0;
END;
November 14, 2019 at 4:34 am
FORMAT is a dog when comes to performance.
You would be better off using CONVERT.
The following 2 expressions return the same result. Although formatting is best left to the presentation...
November 13, 2019 at 4:22 am
I stand to be corrected here, but NOLOCK on a #temptable has no effect. The #temptable is local to your SPID, so there is nobody else reading or writing to...
November 13, 2019 at 4:14 am
Your SQL is not valid.
Your description of the problem does not make sense.
Kindly provide readily consumable sample data, your expected outcome, and a functioning SQL statement.
November 12, 2019 at 3:21 pm
Shifting gears a bit, have a look at the original post on the following thread (no need to pile on.. I'm just confused) ...
The OP posted this early...
November 12, 2019 at 6:34 am
Viewing 15 posts - 391 through 405 (of 1,468 total)