Forum Replies Created

Viewing 15 posts - 8,026 through 8,040 (of 8,731 total)

  • RE: how to get person with multiple rates

    It's quite easy to accomplish this task. The slowest part is to recreate the DDL and sample data. This time I did it on a CTE, but you should take...

    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: How to create the Dynamic Table...

    Sean Lange (6/19/2013)


    What is the purpose of this? This is going to require some pretty complicated dynamic sql for this.

    It's not that complicated, but it seems like a very bad...

    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: pivot query

    Take a look at this articles and return if you still have questions 😉

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Cross Tabs and Pivots, Part 2 -...

    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: If/Then in table valued functions

    Here's one idea, but I have no idea if it will fit your needs or if it will perform fine

    WITH option1 AS(

    SELECT 1 AS column1,

    ...

    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: Creating Table for Pivot Table

    For more information, I recommend you to read the following articles that would even allow you to return a variable number of columns.

    Cross Tabs and Pivots, Part 1 – Converting...

    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: Using between in where clause from subquery

    Arul prakash (6/18/2013)


    SELECT *

    FROM @Client cl

    JOIN @ValidDates vd

    ON 2=2

    where cl.ValidDate BETWEEN vd.StartDate AND vd.EndDate

    Anything we give same value for on condition......

    You missed the point, the OP didn't want...

    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: Insert dummy records

    Let me give you an example by simplifying your code.

    DECLARE @id INT

    SELECT @id= max(id) + 1

    FROM TABLE

    INSERT INTO TABLE (

    id

    ,country

    )

    SELECT

    n

    ,'Germany'

    FROM dbo.Tally

    WHERE n BETWEEN @id AND @id <= 1002261

    You wouldn't...

    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: Insert dummy records

    So, you basically want to generate IDs with the same value X number of times?

    For that, you can check The "Numbers" or "Tally" Table: What it is and how it...

    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: Insert dummy records

    Something like this?

    http://www.sqlservercentral.com/articles/Data+Generation/87901/

    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: Appending a character in Last_Name with a condition.

    Now I am concerned. Do you really need to delete Patient information?

    If it's just to show the names, then this might help.

    WITH Unique_PT AS(

    SELECTPT_LST_NAM + CASE WHEN ALS_FLG = 'Y'...

    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: Need help to create a column, add values and then compare with another table

    Something like this? or am I missing something?

    SELECT *

    FROM OneTable a

    FULL

    JOIN OtherTable b ON substring(a.ANUM,4,10) = substring(b.ANUM,4,10)

    ...

    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: Help with Pivot Queries

    Without sample data to test, I might be giving you the wrong solution but with the previous mentioned articles you should be able to fix it or ask specific questions.

    SELECT...

    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: Help with Pivot Queries

    You should take a look at these articles

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

    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: Need help to create a column, add values and then compare with another table

    The condition is to get the rows that don't exist on either table using the FULL JOIN. I took a shot at guessing ANUM wouldn't be nullable or at least...

    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: Need help in soling a SQL issue

    I can't understand the problem. You say there are no rows where IsResSchedule = 1 , but the code for the new sample data shows 2 rows with IsResSchedule =...

    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 - 8,026 through 8,040 (of 8,731 total)