Viewing 15 posts - 616 through 630 (of 761 total)
Thanx Dwain.
So, if I don't know the number of items then how would I do it using Dynamic SQL??
April 26, 2012 at 12:17 am
OK...my bad...lets forget about printing the names.
I just want the names to be stored in 5 temp variables so that I can use them further.
Can that be done without cursor...
April 25, 2012 at 7:00 am
Does this help?
;With CTE
As
(Select *, ROW_NUMBER() Over (Partition By Brand, Week order by Brand) As rownum From mytable)
Select resp_Id,Brand, FOP = Count(Q5) From CTE Where rownum = 1
AND Cat=11 and...
April 25, 2012 at 6:49 am
+1 Andy...you beat me to it 🙂
April 25, 2012 at 6:31 am
Yea....seems like it was a really long day for you 😀
April 25, 2012 at 6:20 am
Cadavre, i can accomplish that result by this query:
Select * From Ex
😀
But I want the results as follows:
Declare
@temp1 varchar(30) = 'Jack',
@temp2 varchar(30) = 'Vinu',
@temp3 varchar(30) = 'Jim',
@temp4 varchar(30) = 'Stan',
@temp5...
April 25, 2012 at 6:17 am
Have you specified a "Query Execution Time-Out" in "Options" of SQL Server?? ie: Tools-->Options-->Query Execution-->Query Execution Time-Out(in seconds)
Normally, how many rows are there in the Result Set??...It might also depend...
April 25, 2012 at 6:00 am
If you are doing some other complex operations for every person whose name you have given, may be its not possible to remove the CURSOR.
As an example, imagine you have...
April 25, 2012 at 5:53 am
Suppose, I have this DDL and Sample Data:
--DDL
Create Table Ex(Name varchar(30) )
--Sample Data
Insert Into Ex
Select 'Jack'
Union all
Select 'Vinu'
Union all
Select 'Jim'
Union all
Select 'Stan'
Union all
Select 'Ash'
I want to loop through the table,...
April 25, 2012 at 5:32 am
You need to replace your query:
SELECT resp_Id,Brand, FOP = Count(distinct Q5)
FROM #mytable
WHERE Cat=11 and [Month]=1 and Resp_Id=1004
Group by resp_Id,Brand
with this query, for the result you want:
SELECT resp_Id,Brand, FOP = Count(Q5)
FROM...
April 25, 2012 at 5:24 am
@Fitz : So, it all comes down to how the OP decides what the "Latest Date" is.
@rajn.knit07 : Please be more elaborate on how you decide which one of the...
April 25, 2012 at 4:12 am
This is how I managed it.
--Original Table that holds the data
Create table Ex
(
val numeric(18,6),
rownumber numeric(18,6)
)
--Inserting Data
insert into Ex
select 1,1 union all
select 2,2 union all
select 3,3 union all
select 4,4
--Selecting Geometric Mean
Declare...
April 25, 2012 at 4:09 am
Please post the DDL of the tables. May be the table fields are not of the same data types in both tables....Check the link in my signature to see how...
April 25, 2012 at 3:21 am
I am not sure about either of these because both of them have performance limitations.
Can Tally Tables be used in this scenario??
I'm looking to throw away Cursors and Loops from...
April 25, 2012 at 3:17 am
Here are a few links which would help you with Output parameters:
Using a Stored Procedure with Output Parameters
Stored Procedures - Output Parameters & Return Values
Hope this helps.
April 25, 2012 at 3:13 am
Viewing 15 posts - 616 through 630 (of 761 total)