Forum Replies Created

Viewing 15 posts - 5,116 through 5,130 (of 8,731 total)

  • RE: Are the posted questions getting worse?

    Can someone help with a crystal ball or interrogation system for this thread?

    http://www.sqlservercentral.com/Forums/Topic1668185-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: Add calculated row item - SQL 2008

    How do you you know that C is the sum of A and B and not any of the other values? How do you know that O shouldn't sum 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: Add calculated row item - SQL 2008

    How would you expect to differentiate both product groups?

    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 into brand new not created table

    You need to alias your max(val) column. 😉

    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: BETWEEN & PARAMETERS

    Could you use something like this?

    J.[Week] BETWEEN ISNULL(@WeekBegin, -1) AND ISNULL(@WeekEnd, 9999999)

    Functions on parameters don't affect SARGability.

    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 calculated row item - SQL 2008

    Can you 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: Add calculated row item - SQL 2008

    You have 2 options:

    1. Use a UNION ALL with one query including a detail of the products and another one aggregating the information.

    2. Use GROUPING SETS

    SELECT ISNULL( product, 'O') product,...

    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: Tables being used

    What do you mean by being used?

    In that precise moment? In the last days? That have data? That are included in stored procedures, functions or views?

    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: Dynamic SQL Truncating at 4K

    I'm sure your code can get many improvements. Could you post some sample data and DDL to be able to test?

    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: Why temp tables is faster then variable table?

    Have you checked the execution plans with both compatibility levels? You should be getting different plans.

    Table variables don't have statistics and the optimizer always treats them as if they have...

    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: Dynamic SQL Truncating at 4K

    Try this:

    DECLARE @ColumnName2 NVARCHAR(MAX)='East,Central,West';

    SET @ColumnName2 = REPLACE(@ColumnName2, ',', '],[');

    SELECT @ColumnName2

    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: Dynamic SQL Truncating at 4K

    Why aren't you parametrizing your dynamic query?

    Your column list for the pivot is wrong. You set it like this:

    DECLARE @ColumnName2 NVARCHAR(MAX)='East,Central,West';

    And use it in here:

    PIVOT(

    ...

    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: Stripping First & Last Name from Email Address

    This is an option. I'm using CROSS APPLY to reduce code at the formulas. 😉

    SELECT EmailAddr,

    Fullname,

    LEFT(Fullname, CHARINDEX('.', Fullname) - 1) FirstName,

    ...

    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 Write Pivot Statement

    You're describing 3 datasets, which is a terrible idea as you'll have problems managing them.

    Instead, you need a single dataset that can be formatted in the presentation layer which 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
  • RE: Convert date format from DB for app

    Note that if you format your date it won't be a date any more and it will be a string. String dates will give you problems if you try 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

Viewing 15 posts - 5,116 through 5,130 (of 8,731 total)