Viewing 15 posts - 3,106 through 3,120 (of 4,080 total)
The original example was actually following the IF/Begin-End ELSE/Begin-End structure.
By the way, Alvin, enjoyed the presentation Thursday night.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 11, 2009 at 8:24 am
Okay... how many people here advocate the use of GOTO statements in T-SQL?
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 11, 2009 at 8:08 am
GOTO is not uncommon in TSQL
Really? It's been so long since I've seen one, that I'd forgotten that it ever existed.
I'm with Flo. ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 11, 2009 at 8:06 am
You might try running the code before making pronouncements like that. 😉
I'm looking at the following results on my screen right now.
Status State ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 11, 2009 at 7:18 am
Will this work?
declare @sample table (Status varchar(10), State varchar(20), Name Varchar(10))
insert into @sample
select 'Pending', 'Nebraska', 'ABC' union all
select 'Pending', NULL, 'XYZ' union all
select 'Active', NULL, 'PQR'
select *
from @sample
where state...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 10, 2009 at 2:51 pm
You're using the left function in a join, which might prevent proper use of indexes. You might also want to consider an approach like this. Warning:...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 10, 2009 at 2:37 pm
Sure. Have a look at this and let me know if you have any questions.
declare @sample table (SessionID int, question varchar(30), response varchar(30))
insert into @sample
select 1, 'Name', 'Mike'...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 10, 2009 at 2:18 pm
I just re-read your question. Since you have the metadata that defines names, datatypes, and lengths for your output columns, you could parse those attributes to build 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
April 10, 2009 at 7:59 am
Read about OPENXML on books online. You can query an XML document and simply write the results to a table, then look at the schema. ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 10, 2009 at 7:51 am
If you would please write a short script to define temporary tables and put a few rows into them, then people can test their solutions to your problem before posting...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 10, 2009 at 7:12 am
have you heard of Schrödinger's cat???
Heard of it? I'm in the box with it!!
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 10, 2009 at 7:03 am
I just revised the final select clause in the previous post to match your output example exactly.
It looks like a lot of code, but it runs in a millisecond 😉
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 9, 2009 at 2:59 pm
How about this then? I would have had it for you sooner, but your order threw me. Your example shows the combinations in an unusual sequence. ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 9, 2009 at 2:44 pm
In the code below, the "Combos" cte is used to develop concatenated strings of the TXNCDs for each BON. After that, a simple count of the combinations produces...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 9, 2009 at 2:20 pm
Always happy to help, Flo. 🙂
By the way, Mark is right. NULLS shouldn't count. My code above would give false results if null values...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
April 9, 2009 at 12:36 pm
Viewing 15 posts - 3,106 through 3,120 (of 4,080 total)