Forum Replies Created

Viewing 15 posts - 4,306 through 4,320 (of 8,731 total)

  • RE: select statement with derived order status

    Do you need a select?

    I started to work on an update, but it might give you an idea.

    CREATE TABLE #Order(

    OrderID ...

    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: ORDER BY- Decimal/hyphen - HELP NEEDED!!

    chindilog (8/28/2015)


    The problem here is, I am not using any tool. I am working on inventory tool, which through JDBC connects to database server. Database is called fishbowl database. Once...

    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: Today's Random Word!

    Ed Wagner (8/28/2015)


    DonlSimpson (8/28/2015)


    SQLRNNR (8/28/2015)


    'tater salad

    Ron White

    White Potatoes

    black beans

    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: ORDER BY- Decimal/hyphen - HELP NEEDED!!

    Of course, you need some tweaking to make it numeric.

    CREATE TABLE #SampleData( num varchar(100));

    INSERT INTO #SampleData VALUES

    ('1000:001'),

    ('1001:001'),

    ('1002:001'),

    ('999:001'),

    ('998:001'),

    ('99:001'),

    ('1:001'),

    ('2:001'),

    ('3:001');

    --This won't work correctly

    SELECT * FROM #SampleData ORDER BY num

    --This...

    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: Cursor function and drop user/logon

    Actually, serverproperty('ProductVersion') returns the version in the form of 'major.minor.build.revision'.

    Here are some changes to your code which might follow a better logic.

    - I changed the @ver to an integer...

    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: CTE within a stored proc

    mar.ko (8/28/2015)


    I want the EXEC right after the CTE.....no can do.

    I put a semicolon after the last paren of the CTE and that throws a syntax error.

    Something strange is happening...

    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: CTE within a stored proc

    Are you ending your statements with semicolons?

    Other than that, I would need to see some sample code to be sure what are you talking about.

    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: Cursor function and drop user/logon

    I included some comments on your code.

    DECLARE @ver nvarchar(128);

    DECLARE @UserName nvarchar(50);

    DECLARE @UserD nvarchar(80);

    DECLARE @LoginD nvarchar(80);

    -- Initialize the variable.

    SET @ver = CAST(serverproperty('ProductVersion') AS nvarchar)

    SET @ver = SUBSTRING(@ver, 1, CHARINDEX('.', @ver) -...

    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: Not Exist causing major performance problem

    Read the article on your signature on how to post performance questions.

    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: Use a select within a table field in a 2nd query

    No need to loop, the code that I posted will traverse the entire table and create the complete statement.

    Here's a slightly different example:

    CREATE TABLE ScriptTable(

    groupID Nvarchar(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: Execute procedure in procedure?

    First you were truncating the date because you inserted the string value into a date variable and were expecting an 8 character string, so the variable converted again from date...

    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: Use a select within a table field in a 2nd query

    Something like this could work if you always return the same columns.

    DECLARE @sql nvarchar(max) ;

    SELECT @sql = ISNULL( @sql + CHAR(10) + 'UNION ALL ' + CHAR(10), '')

    + SQLStatement

    FROM...

    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: Execute procedure in procedure?

    ScottPletcher (8/27/2015)


    Since you literally can't add enough values here to make a cursor all that bad, you might want to use a cursor just to have better control over 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: DATEADD and leap years

    patrickmcginnis59 10839 (8/27/2015)


    drew.allen (5/30/2012)


    dwain.c (5/29/2012)


    Datetime functions do have their issues though, like the following:

    SELECT DATEADD(month, 1, '2012-02-29')

    Depending on your point of view, the results this returns looks wrong, or maybe...

    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: Execute procedure in procedure?

    Of course, you can do it without a cursor and a bit of dynamic sql.

    Create procedure call_procedure(

    @multiple_weeks varchar(8000)

    )

    AS

    ----Sample Data

    --DECLARE @multiple_weeks varchar(8000) =...

    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 - 4,306 through 4,320 (of 8,731 total)