Forum Replies Created

Viewing 15 posts - 6,751 through 6,765 (of 8,731 total)

  • RE: Cursor taking long time

    Igor Micev (3/14/2014)


    Do you know that cursors' performance is nearly the same to the set-based statements when they are run on up to about 1000 rows.

    Not really, it might look...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Function to list distinct pax name and ticket no?

    You didn't post any expected results.

    However, here are two options you could use depending on what you want.

    DECLARE @BookRef char(100) = 'ABCDE'

    SELECT strFiPaxName_FD

    ,STUFF((SELECT '/' + LTRIM(RTRIM(strFiTktNo_FD))

    FROM #Items x

    WHERE x.strFiPaxName_FD =...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Cursor taking long

    Pritz (3/14/2014)


    Update dbo.voters

    Set rec_num = DENSE_RANK() OVER( ORDER BY part_no)

    from dbo.voters

    Got the error for the script above.

    can you re-post the corrected one? I cannot see it.

    Thanks,

    I could...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Cursor taking long time

    I suggest that all answers should be posted on the other thread.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Cursor taking long

    Noting that you're on 2005 (as you noted in the other thread), you could use the DENSE_RANK function.

    Update dbo.voters

    Set rec_num = DENSE_RANK() OVER( ORDER BY part_no)

    from dbo.voters

    with...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Cursor taking long

    You posted in 2 different forums for 2 different versions, please define which one would you like to consider. The other post is this one: http://www.sqlservercentral.com/Forums/Topic1551279-65-1.aspx

    Your code seems to do...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Cursor taking long time

    You posted in 2 different forums for 2 different versions, please define which one would you like to consider. The other post is this one: http://www.sqlservercentral.com/Forums/Topic1551281-391-1.aspx

    Your code seems to do...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Function to list distinct pax name and ticket no?

    Can you post your sample data and expected results in the form of DDL and INSERT statements?

    It looks like you need something like this: http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    But if you post your data...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Yet another pivot question

    You can take a look at cross tabs in this article: http://www.sqlservercentral.com/articles/T-SQL/63681/

    And here's an example:

    SELECT ID

    ,MAX(CASE WHEN field = 'LastName' THEN FieldValue END) AS LastName

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Remove certain words from a string

    With out the spaces added to both sides of the words, the string 'the foreign institute of comics' would become 'feign institute comics', just to give an example.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Remove certain words from a string

    Just to keep it safer, here's a modification to Sean's option.

    DECLARE @str varchar(100) = 'the foreign institute of comics'

    select @str = REPLACE(' ' + @str + ' ', ' '...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Count days per month per year between 2 dates

    Actually, you don't have to create and drop the calendar table. Calendar tables are meant to make date calculations easier and should be permanent tables. With the proper indexing, they...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Building a hierarchy tree

    That's good to know (that it worked not the bad data).

    Now the question is, do you understand how does it work?

    This article [/url]might give you a lot of information on...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Building a hierarchy tree

    I'm sorry, but I can't help you a lot right now. I'm busy at my job and can't examine carefully your information.

    There are two possible reasons for this error. You...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Speed Up Query by replacing Subselects

    I would like to help you (as well as others in this site), however, due to the differences between Oracle and SQL Server, I'm not sure that I can suggest...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 6,751 through 6,765 (of 8,731 total)