Viewing 15 posts - 2,596 through 2,610 (of 4,080 total)
declare @input varchar(100)
set @input = '000100010001'
;with tally (N) as (select row_number() over (order by id) from master..syscolumns)
select N from tally
where substring(@input,N,1) = '1'
and N <= len(@input)
edited to...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 20, 2009 at 10:43 am
Hey J-F,
Your subquery solution is cleaner in that it avoids the uneccessary join to the item table to find the unwanted ItemIDs. The CTE solution should be...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 3:04 pm
Thanks for posting the sample data!!! It made my job MUCH simpler. 🙂
The following solution uses explicit JOINS because your use of the WHERE clause with a...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 2:51 pm
Use CONVERT, because CAST doesn't give you all the formatting options.
The new datatypes aren't necessary unless you want to disregard time or store really ancient dates. But you...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 2:31 pm
The internal storage of date and datetime information is actually an integer datatype, not a character string. However, it is presented as character string when you do a...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 2:18 pm
Still don't see why what you have isn't working. But I do see that you are using a while loop in your parse function. ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 2:11 pm
While waiting on the parsestring function to be posted, I will also ask if you have considered rewriting it as a parse to produce a derived table to feed the...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 1:28 pm
Awwww... that's not true... I've got a couple thousand... errr dozen at most.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 1:07 pm
Hey Michelle 🙂
If you didn't already know, Lynn is renowned for his patience to the point that he has often been called Saint Lynn by the regulars at SSC....
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 11:49 am
Glad you like it, Lynn.
Steve: Suggestion for new functionality... name/avatar history. 😀
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 11:28 am
Humor is subjective. In some people's cases, it needs to be subjected to a baseball bat.
Hey! I resemble that remark!
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 19, 2009 at 11:03 am
With the column changes in place, this works.
declare @sample table (eligMonth dateTime, membID int)
insert into @sample
select '2009-07-01', 899931100 union all
select '2009-07-01', 899931700 union all
select '2009-07-01', 899931000...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 18, 2009 at 1:21 pm
You are right of course that it would be nice to have some sample data from the author of the question. For example, we don't know if a...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 18, 2009 at 12:52 pm
If a member can appear multiple times with multiple eligibility dates, and you are ONLY concerned about the current month and the previous month, then
declare @sample table (member int,...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 18, 2009 at 12:48 pm
Why can't you just test their membership date against the first day of this month?
declare @sample table (member int, memberDate datetime)
insert into @sample
select 1, '7/9/2009' union all
select 2, '7/19/2009'...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 18, 2009 at 12:39 pm
Viewing 15 posts - 2,596 through 2,610 (of 4,080 total)