Viewing 15 posts - 2,941 through 2,955 (of 4,087 total)
I actually prefer using sys.dm_sql_referencing_entities. I found that I was getting false positives using the LIKE operator, because people had commented out sections of code, so the table name...
August 28, 2015 at 3:12 pm
Lynn Pettis (8/28/2015)
Lowell (8/28/2015)
must be terminated with a semicolon. that's probably where the issue likes.
that issue makes a lot of people precede their...
August 28, 2015 at 11:22 am
mar.ko (8/28/2015)
Ed Wagner (8/28/2015)
August 28, 2015 at 10:06 am
alemmon2 (8/28/2015)
August 28, 2015 at 9:09 am
The first thing I notice is that you are excluding SQL 2008. You have tests for > 10, and < 10, but not = 10.
On a separate note, replace...
August 28, 2015 at 8:13 am
Jo6205 (8/27/2015)
I'm working in a stored procedure (not mine) and need to update a parameter. When a user runs the report, there is an option to pull jobs based...
August 27, 2015 at 11:30 am
For completeness, ordering by one of the partition expressions is pointless. The ORDER BY clause orders the records within the partition. Since all rows within a partition have...
August 26, 2015 at 7:51 am
Also note that
SUBSTRING(DOB,1,2)+SUBSTRING(DOB,3,2)
is the same as
SUBSTRING(DOB,1,4)
I don't know if it will make a noticeable difference in performance, and I don't have the time to test it right now.
Drew
August 25, 2015 at 7:44 am
This will generally perform much better than a UNION. I also replaced your TotalPrice * -1 using the unary operator.
SELECT t.*
FROM Accounts
CROSS APPLY (
VALUES('Asset', 'House', -TotalPrice)
,('Balance', 'Cover', TotalPrice)
) AS...
August 20, 2015 at 12:27 pm
Lowell (8/19/2015)
--first critieria
SELECT OT.Week_id,OT.Jobnbr,OT.tasknbr FROM @data OT WHERE item_type = 'TASK' GROUP BY OT.Week_id,OT.Jobnbr,OT.tasknbr
EXCEPT
SELECT Week_id,Jobnbr,tasknbr FROM @data OH WHERE item_type = 'HOLD' AND item_id <> 'MATL' GROUP...
August 19, 2015 at 1:30 pm
I think this is more efficient since it only requires reading the table once instead of three times.
SELECT d.week_id, d.jobnbr, d.tasknbr
FROM @data d
GROUP BY d.week_id, d.jobnbr, d.tasknbr
HAVING MIN(
CASE
WHEN d.item_type =...
August 19, 2015 at 1:21 pm
ScottPletcher (8/19/2015)
Be careful. The ? is replaced with a fully delimited schema and table, such as:
[dbo].[table1]
I didn't realize that was the case. In that case my query above...
August 19, 2015 at 12:56 pm
You can use the following:
SELECT t.TABLE_NAME, REPLACE(@cmd, '?', t.TABLE_NAME)
FROM INFORMATION_SCHEMA.TABLES t
The table name doesn't (typically) end with a ']', so it won't delete any records.
Also '_' is a wildcard, so...
August 19, 2015 at 11:53 am
Eirikur Eiriksson (8/18/2015)
😎
USE tempdb;
GO
SET NOCOUNT ON;
declare @Process table(ProcessId int identity(1,1) primary key,ProcessName varchar(100),ParentStep int, ChildStep int);
Insert into @Process(ProcessName,ParentStep,ChildStep)
select 'Process1',1,2 union all
select 'Process2',1,3 union all
select 'Process3',1,6 union all
select 'Process4',4,2 union...
August 18, 2015 at 1:30 pm
Eirikur Eiriksson (8/14/2015)
drew.allen (8/14/2015)
Eirikur Eiriksson (8/14/2015)
August 17, 2015 at 7:13 am
Viewing 15 posts - 2,941 through 2,955 (of 4,087 total)