Forum Replies Created

Viewing 15 posts - 8,356 through 8,370 (of 8,731 total)

  • RE: Interesting query - remove duplicates from my table

    Are you sure that works?

    For me it has errors. There's no such thing as "DELETE field FROM Table" as it will delete the entire row. And AFAIK you can't use...

    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: Consolidating records - TSQL problem

    I like the possibilities that rCTEs give us, but I also believe that sometimes the simplest way is the best way to go.

    I'm glad I could help.

    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: read multiple fields with common delimited data into either a temp table or table variable without using cursors

    If you want something dynamic, you will need dynamic sql code.

    Another way to do it would be concatenating the fields (up to 19 with your current length)

    select item

    from TestTable

    cross apply...

    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: SQL server in loop Evaluation

    This is a repeated thread.

    Original thread is in here http://www.sqlservercentral.com/Forums/Topic1363791-391-1.aspx

    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: Advanced (?) SUM

    I think I figured it out.

    If you analyze the data it's easier to watch what you're trying to do. Thanks for DDL and sample data.

    SELECT articletype, SUM( freight) FROM(

    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: Consolidating records - TSQL problem

    I know it could be a bad solution, and maybe you had tought about it.

    But since the rCTE is not scaling well (and it sure won't) why don't you use...

    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: SQL server in loop Evaluation

    yuvipoy (9/25/2012)


    Thanks for your replay,

    As i have stated early [Quote]Inserting the data externally not from the database itself. [/Quote] my aim is not inserting from the database i need to...

    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: SQL server in loop Evaluation

    yuvipoy (9/25/2012)


    [Quote]

    INSERT INTO test(col1, col2) VALUES

    ( @param1, @param2),

    ( @param1, @param2),

    ( @param1, @param2),

    ( @param1,...

    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: string operation

    Mark-101232 (9/25/2012)


    Luis Cazares (9/25/2012)


    I made a different adjustment and seems easier to read (at least for me :-D)

    SELECT SUBSTRING(@s,t2.number,t1.number)

    FROM master.dbo.spt_values t1

    INNER JOIN master.dbo.spt_values t2 ON t2.type='P' AND t2.number BETWEEN 1...

    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: string operation

    I made a different adjustment and seems easier to read (at least for me :-D)

    SELECT SUBSTRING(@s,t2.number,t1.number)

    FROM master.dbo.spt_values t1

    INNER JOIN master.dbo.spt_values t2 ON t2.type='P' AND t2.number BETWEEN 1 AND LEN(@s)

    WHERE...

    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: SQL server in loop Evaluation

    What I was really hoping to see is how the final statement looks when you execute it.

    It's different if it looks like this

    INSERT INTO test(col1, col2) VALUES( @param1, @param2)

    INSERT INTO...

    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: SQL server in loop Evaluation

    Are you just trying to measure performance in SQL Server?

    Most of the people here won't take the approach you're using. I'm not sure what is completely your goal.

    If you're...

    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: sum every two number combination

    I don't have anything to test with, but I believe this could be better.

    However, the problem is that it's still using a cartesian product to obtain the result.

    SELECT TAB1.SalesOrderId AS...

    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: Understanding the difference between Join and Where filters - SQL 2008R2

    You'll have better performance if you change the following statement

    WHERE SD.Code IS NOT NULL AND RTRIM(LTRIM(SD.Code ))<>''

    with

    WHERE SD.Code <> ''

    The results are the same and you can test them if...

    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: Decimal to DateTime2 conversion SQL SERVER 2008 help

    I can see that you're new in here. I really would like to help you but there's nothing I can't do unless you give me something to work with. I...

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