Forum Replies Created

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

  • 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...

  • 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

  • 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...

  • 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...

  • 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...

  • 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.

  • 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) -...

  • RE: Not Exist causing major performance problem

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

  • 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),

    ...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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) =...

  • RE: string columns containing alphanumeric

    Another possibility.

    SELECT *

    FROM #temp

    ORDER BY CASE WHEN Section NOT LIKE '%[^0-9]%' THEN CAST( Section AS int) * -1

    ...

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