Forum Replies Created

Viewing 15 posts - 616 through 630 (of 761 total)

  • RE: Replacement for Cursors

    Thanx Dwain.

    So, if I don't know the number of items then how would I do it using Dynamic SQL??

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Replacement for Cursors

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Occurrence count

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Select a set of Maximum (or minimum) values with a associated data

    +1 Andy...you beat me to it 🙂

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Unable to connect to SQL Server 2008 r2 named instance

    Yea....seems like it was a really long day for you 😀

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Replacement for Cursors

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: timeout even after (NoLock)??

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Replacement for Cursors

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Replacement for Cursors

    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,...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Occurrence count

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: how to get latest last week dates from the given date

    @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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Get Geometric Mean for all the records

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: copying data one table to another table in sql

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: Replacement for Cursors

    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...

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • RE: How to create dynamic function

    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.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

Viewing 15 posts - 616 through 630 (of 761 total)