Viewing 15 posts - 436 through 450 (of 4,080 total)
santiagoc93 (7/9/2016)
with Mycteas
(
select ROW_NUMBER()over(order by id)as c, t.* from ##TEST as t
)
select t1.DT as "startDate", t2.DT as "endDate"from Mycte as t1
left join Mycte as t2
on t1.ID =t2.ID and t1.c=t2.c-1
Just...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 11, 2016 at 8:00 am
J Livingston SQL (7/8/2016)
Zidar (7/8/2016)
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 8, 2016 at 1:47 pm
Hey Zidar, here is the function and check constraint to avoid overlap. Can't guarantee it's flawless, I just knocked it out during a break.
I presume you are...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 8, 2016 at 1:46 pm
How to enforce 2 or 3?
CREATE UNIQUE INDEX IX_#subscriptions ON #subscriptions (SubscriberID, UnsubScribedDate)
will work for our example where the definition of an active subscription is one without an UnsubscribeDate....
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 8, 2016 at 10:26 am
Thank you for putting in the effort to create the constraints.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 8, 2016 at 10:12 am
A CASE expression is an expression, just like a formula or function.
Its logic produces a single scalar value.
It is not another version of...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 8, 2016 at 8:39 am
Yes, the MSDN documentation on it isn't very clear, but you can find it on the OUTPUT Clause page in the section on Arguments.
I see it in the syntax...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 5:26 pm
I don't have time to write a paper at the moment, so this will have to suffice. 🙂
I've read Mr. Celko's books, and I have seen some truly execrable flat...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 5:01 pm
If you have the ability to change your transactional code I would suggest this, only because subscriptions are always paired with cancellations.
create table ##TEST (ID int, SubscribeDate date, UnsubscribeDate date)
New...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 2:43 pm
If result.Ip_Code is a number, you could always use it's negative in place of DESC
CASE WHEN result.Pc_CrFCIC IN (52, 53) THEN result.Ip_Code ELSE -result.Ip_Code END,
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 1:22 pm
Found one: http://sqlblog.com/blogs/rob_farley/archive/2012/06/12/merge-gives-better-output-options.aspx
Stefanie, not sure why I missed reading your message with the sample code I wanted. But thanks to you as well.
Thanks to you all.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 12:47 pm
Drew, that sounds like the answer to a maiden's prayer, and I'd like to remember it for future reference, but after reading your note I looked at the MSDN pages...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 12:36 pm
DECLARE @Inputs TABLE (RowID INT IDENTITY(1,1) PRIMARY KEY, TextString VARCHAR(100))
insert INTO @inputs
VALUES ('SELECT * from client where id = ''789546'' and county = ''Northants''')
,('select * from client where id =...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 12:26 pm
TheSQLGuru (7/7/2016)
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 11:18 am
drew.allen (7/7/2016)
If you change your INSERT to a MERGE, then you can just OUTPUT the original GUID. Of course, the MERGE introduces it's own problems.Drew
I'm not following you, Drew....
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 7, 2016 at 11:09 am
Viewing 15 posts - 436 through 450 (of 4,080 total)