Viewing 15 posts - 8,071 through 8,085 (of 8,731 total)
It's really easy
select @Count1=count(*) from [test] where [testcol] = 10
select @Count2=count(*) from [test1] where [testcol] = 10
IF @Count1<=0 AND @Count2<=0
BEGIN
-- Your SP code here
END
June 11, 2013 at 9:28 am
Also, you need to define more the logic you're using because you haev some possible flaws in your code and I see no reason to go row by (agonizing) row.
A...
June 10, 2013 at 1:06 pm
Jeff Moden (6/6/2013)
Luis Cazares (6/6/2013)
How come neither of us got that simple and effective solution? I need to go back to practice the KISS mantra.
BWAAA-HAAA!!! I have null idea of...
June 7, 2013 at 6:09 pm
I have a solution for you that will get the result for a player with 3 consecutive games with the same score.
drop table #gamescores
create table #gamescores
(gameNo varchar(20) not null,
player varchar...
June 7, 2013 at 5:59 pm
josh.granville (6/7/2013)
polkadot (6/7/2013)
I've got to figure out whose games scores changed the least over time. I've created DDL to illustrate
create table gamescores
(gameNo varchar(20) not null,
player varchar (20) not null,
score...
June 7, 2013 at 3:14 pm
Aren't you missing the @ on your variable declaration?
DECLARE @BalanceDue money, @ktr int
June 7, 2013 at 11:44 am
Jeff Moden (6/6/2013)
Luis Cazares (6/6/2013)
Sean Lange (6/6/2013)
Here is another:
select stuff(isnull(col1 + '/', '') + isnull(col2 + '/', ''), LEN(isnull(col1 + '/', '') + isnull(col2 + '/', '')), 1, '')
from Table_1
Sean,...
June 6, 2013 at 10:39 pm
Luis Cazares (6/6/2013)
ScottPletcher (6/6/2013)
Sean Lange (6/6/2013)
ScottPletcher (6/6/2013)
Given table1 with columns "id" and "value", where each id has 1 to 3 values/rows in the table:
Describe the essentials of a single...
June 6, 2013 at 3:47 pm
ScottPletcher (6/6/2013)
Sean Lange (6/6/2013)
ScottPletcher (6/6/2013)
Given table1 with columns "id" and "value", where each id has 1 to 3 values/rows in the table:
Describe the essentials of a single query (no...
June 6, 2013 at 3:32 pm
Sean Lange (6/6/2013)
Here is another:
select stuff(isnull(col1 + '/', '') + isnull(col2 + '/', ''), LEN(isnull(col1 + '/', '') + isnull(col2 + '/', '')), 1, '')
from Table_1
Sean, you gave me an...
June 6, 2013 at 1:34 pm
Just another option
select CASE WHEN col1 + col2 IS NULL
THEN COALESCE( col1, col2, '')
ELSE col1 + '/' + col2 END as secondtry
from Table_1
June 6, 2013 at 1:20 pm
It's not an elegant solution but it works
select isnull(col1,'') + ISNULL( RIGHT( col1 + col2 + '/', 1), '') +rtrim(isnull(col2,'')) as firsttry from Table_1
June 6, 2013 at 1:16 pm
No need for a loop, what you need is a Tally (numbers) table.
The "Numbers" or "Tally" Table: What it is and how it replaces a loop.[/url]
June 6, 2013 at 9:32 am
I was going to suggest the CROSS APPLY UNPIVOT[/url] but I realized it was the 2005 forum.
There's not a great solution with denormalized data like this one. A UNION ALL...
June 6, 2013 at 9:23 am
This is not the optimal solution, you would be better using dates. For a better performing query, please post DDL and sample data as indicated on the article linked in...
June 6, 2013 at 8:56 am
Viewing 15 posts - 8,071 through 8,085 (of 8,731 total)