Forum Replies Created

Viewing 15 posts - 13,096 through 13,110 (of 15,381 total)

  • RE: Query question

    Nice job posting ddl and sample data.

    Here is one way off the top of my head.

    select program, pstatus, form

    from

    (

    select *

    , ROW_NUMBER() over (partition by program order by...

  • RE: loops and cursor

    Here is an example of what I mean (based on your previous post)

    create table #TableA

    (

    TextName char(3)

    )

    create table #TableB

    (

    ID int,

    Ind int,

    TextName char(3)

    )

    insert #TableA

    select 'ABC'

    union all

    select 'DEF'

    union all

    select 'GHI'

    insert #TableB

    select 101,...

  • RE: loops and cursor

    I can't post the data as it is sensitive therefore I was trying to take Employee Dept example.

    That's no problem. Just make up some sample data.

    Problem Statement : For each...

  • RE: I am trying to avoid cursors, what other option can I use?

    Can you explain more clearly what you are trying to do? I don't see what a cursor has to do with this at all. Are you trying to update table1...

  • RE: Use an Alias in a sql script

    andre-394971 (2/2/2012)


    No Problem, Thanks for the response... I understand that the request i put forward was not correct , I was wondering if things had changed in sql server to...

  • RE: query makes tempdb full

    Another thing you could do that would help with the size is to remove

    S.SchoolName, S.School

    from each one of the subqueries. It is not needed or referenced outside of...

  • RE: data exporting issue

    You're welcome. Glad that worked for you.

  • RE: WHERE To Exclude %

    So what does the actual data in the column look like? Your description left me scratching my head in bewilderment. :w00t:

  • RE: SQL Results Of Multi-Value Transposed To 1 Row ("Flat File")

    What you are working is a dynamic cross tab. It is outlined in the second article I posted but you have to get a bit creative with your aggregation to...

  • RE: Create a Unique ID for Rows

    There is absolutely no reason to do this row by row. Below is an example that meets the requirements as you described them.

    create table #Table1

    (

    FirstName varchar(20),

    LastName varchar(20),

    Occupation varchar(70),

    ID uniqueidentifier

    )

    create table...

  • RE: WHERE To Exclude %

    EdA ROC (2/1/2012)


    In English: Need to select for records where the value is not equal to %.

    Here's where I am in developing the statement:

    select ORDER_NO, SUM(qty_alloc)

    from ORD_MATL_CST

    where MATL_CATEGORY = 'RSCMP'...

  • RE: Create a Unique ID for Rows

    Look at the output clause. http://msdn.microsoft.com/en-us/library/ms177564.aspx

    For the record unless you have a real reason for uniqueidentifier I would not use them as your primary key. I would suggest that an...

  • RE: SQL Results Of Multi-Value Transposed To 1 Row ("Flat File")

    Does something like this get you closer?

    Notice I created ddl and sample data so we know we are all on the same page.

    create table #data

    (

    ParentID int,

    ChildName varchar(25)

    )

    insert #data

    select 1, 'Tom'

    union...

  • RE: Find the no of hours and minutes between two datetime values

    Cadavre (2/1/2012)


    Sean Lange (2/1/2012)


    You take the RIGHT road and I'll take the LEFT road, and I'll be in Scotland before ye. :Whistling:

    Oh dear. . . has it been a long...

  • RE: ? on cursor

    I think I would cry in public if I found this cursor on my system

    +1

Viewing 15 posts - 13,096 through 13,110 (of 15,381 total)