Forum Replies Created

Viewing 15 posts - 5,941 through 5,955 (of 8,731 total)

  • RE: pivot 3 columns<!-- 864 -->

    Something like this?

    create table test

    (flsa_status varchar(30),

    bu_dept varchar(30),

    reg_temp varchar(5),

    ftpt char(2),

    value int)

    insert into test values ('Exempt Salaried','Corp','Reg','FT',43);

    insert into test values ('Exempt Salaried','Corp','Reg','PT',10);

    insert into test values ('Exempt Salaried','Corp','Temp','FT',12);

    insert into test values ('Exempt Salaried','Corp','Temp','PT',2);

    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: Rolling Max Value<!-- 864 -->

    I totally missed that part and understand your pain.

    For now, the logic indicates that the "wide" join you're using seems the best option with one slight modification. You can remove...

    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: Rolling Max Value<!-- 864 -->

    Can you give me an example on what you just said? Are you trying to do a ranking? Or am I misunderstanding you?

    Partitioning (using windows) the results is possible, but...

    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: Rolling Max Value<!-- 864 -->

    The Quirky Update is easy to get, assuming that you already know the rules to follow.

    Here's an example with your sample data.

    DECLARE @Value float=0,

    @id int

    UPDATE 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: Add a total column<!-- 864 -->

    I'd use a cross tabs approach which seems more flexible, but that's up to you.

    SELECT YEAR(DateFormCompleted) AS YearRecruited,

    Hospital,

    COUNT(CASE WHEN month(DateFormCompleted) = 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: How to over come the Data Issue<!-- 864 -->

    But in the advanced "tab" from your flat file connection manager, there's a data type and length defined. The truncation might be occurring in there.

    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: Scalar UDF versus Inline UDF<!-- 864 -->

    If it's a currency exchange rate table, you'll always need the date. There's no use of a rate without the date. A non-clustered index makes no sense because the clustered...

    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 over come the Data Issue<!-- 864 -->

    How is the column defined on your flat file connection?

    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: Scalar UDF versus Inline UDF<!-- 864 -->

    One reason can be that scalar functions work row by row while inline functions don't.

    Or it could be that scalar functions prevent parallelism (because of the previous cause) and...

    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 - SQL Server String Concatenation with Null<!-- 864 --><!-- 864 -->

    If you concatenate anything to NULL, it will return NULL. The same way as if you try to do an arithmetic operation with NULL.

    You can validate for nulls.

    select idx,

    '[LevelID]=' +...

    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: Working with coalesce on a view<!-- 864 -->

    I used the MAX function because I'm not sure what kind of data you need, so it will aggregate the data to get a single result. You might need a...

    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: Working with coalesce on a view<!-- 864 -->

    Your problem is the double FULL OUTER JOIN as you can see if you use SELECT * to show all rows and columns.

    Here's an alternative, but you should reevaluate the...

    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 How do i create Temp table with declarations<!-- 864 -->

    As Sean said, there are better ways to do it than a cursor. Here's an option using XML PATH which is explained in the following article: http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    To solve your problem,...

    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: Very weird: SSIS package can only load 255 rows from excel<!-- 864 -->

    Since a previous poster said that everything was correct on XP but not on Server 2003, my guess is that you might want to check that you have the correct...

    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: Determine which pattern comes first in a string<!-- 864 --><!-- 864 --><!-- 864 --><!-- 864 -->

    I was just going to mention that. Here's a revised version to include strings with no matches at all using OUTER APPLY.

    WITH cteString ( ArtifactID, PATH )

    ...

    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 - 5,941 through 5,955 (of 8,731 total)