Viewing 15 posts - 136 through 150 (of 444 total)
Next, looks like this subquery will always return rows with LKC2.seq == 1, if any.
(select LKC.lockID,LKC.seq,A.lockCombo2
from
[LockerPopulation] A
JOIN TST.dbo.School SCH ON A.schoolnumber = SCH.type
JOIN TST.dbo.Locker LKR ON...
July 30, 2015 at 4:18 am
Type of, pseudocode
create procedure newProc (
@Plan_Indicator_ID
@FinancialYearID,
@RangetypeID,
@VersionID
)
as
if (@VersionID is null and @RangetypeID is not null ) then
firstProcCode (@Plan_Indicator_ID,@FinancialYearID,@RangetypeID)
else if (@VersionID is not null and @RangetypeID is...
June 24, 2015 at 1:34 am
declare @currentWeek int =26
select ...
from (...) as t -- selects exactly 52 rows you need
order by case when @currentweek >= t.week then 100+t.week else t.week
June 24, 2015 at 1:11 am
sqlinterset (6/22/2015)
from 1 month to current...
June 23, 2015 at 7:45 am
Dohsan (6/19/2015)
Here's one using a recursive CTE, if I have time I'll have a go at a set based solution
This will not produce correct result for the input...
June 19, 2015 at 6:45 am
Having 2 very similar updates like
UPDATE t SET
t.AODYD = <exp1>
FROM <table expression>
WHERE <common predicates> AND <predicate1>
UPDATE t SET
t.DAODYD = <exp2>
FROM <table expression>
WHERE <common predicates> AND <predicate2>
you logically...
May 28, 2015 at 3:23 am
Using your setup above
DECLARE @dt DATETIME = cast('2014-11-25' AS DATETIME);
SELECT cast(dt as date) dt
,Order1
,COUNT(UNit.UNIT) AS Units
,SUM(CASE
WHEN (datediff(dd, INSV_DATE, d.dt)) >= 31
THEN 31
WHEN (datediff(dd, INSV_DATE, d.dt)) < 0
THEN...
May 21, 2015 at 2:52 am
MSDN has ADO.NET Code Examples https://msdn.microsoft.com/en-us/library/dw70f090(v=vs.110).aspx to start with.
First look at SqlClient namespace which is ADO.Net specific toolset for MS SQL DBs.
Having already done some Db related projects...
May 15, 2015 at 3:05 am
See Remarks in CREATE TABLE https://technet.microsoft.com/en-us/library/ms174979.aspx
Trigger is executed within the scope where insert is emitted which is essentially scope of PROCEDURE here. And trigger has its own scope. Trigger has...
May 14, 2015 at 8:27 am
This is bitwise AND. It requires INT operands
Look at
declare @i int = 13
Select @i & 1 bit1, @i & 2 bit2, @i & 4 bit3, @i & 8 bit4
May 14, 2015 at 8:04 am
Try move OUTPUT into trigger and use temp table created in the proc.
ALTER trigger tr_tmessage on tmessage
instead of insert
as
--Set NoCount On
insert into tmessage
OUTPUT inserted.ID INTO #tt
select dscp from inserted
GO
--
ALTER proc...
May 14, 2015 at 7:33 am
BOL:
Triggers
Columns returned from OUTPUT reflect the data as it is after the INSERT, UPDATE, or DELETE statement has completed but before triggers are executed.
For INSTEAD OF triggers, the returned...
May 14, 2015 at 7:05 am
Too many unknown parameters. First, what are criteria to extract family name? Last word exactly? Lookup table of all known family names? second word after [last] 'and' plus all the...
May 14, 2015 at 3:48 am
What is expected result for the sample data like this ?
INSERT INTO @T
SELECT 1 AS Id, 'A' AS Category, NULL AS ActivationDate UNION ALL
SELECT 2, 'X', NULL UNION ALL
SELECT 2,...
May 14, 2015 at 3:23 am
Viewing 15 posts - 136 through 150 (of 444 total)