Forum Replies Created

Viewing 15 posts - 2,131 through 2,145 (of 8,731 total)

  • RE: Help: Truncate tables with same prefix

    pietlinden (9/22/2016)


    You could use something like this.. I would recommend commenting out the EXEC statement and just printing the SQL to make sure the SQL statement is correct.

    Too many...

    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 do I initialise a sql variable to 0 in stored-procedure ?

    I'll repeat it, no one has access to the SQL Server code except for people at Microsoft.

    If you liked the Eirikur's example, here's a variation to show the difference between...

    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: T-SQL Stored procedure with multiple if-else conditions

    Make sure you have the correct number of BEGIN and END.

    Without details, that's the only thing I could find.

    EDIT: Also check your variables declaration.

    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: Rounding Tips and Tricks

    levenyu (9/23/2016)


    Luis,

    Thank you for the reply.

    There is no issue with using word Length in there, it was that (-1) value of the @Length variable, which has caused wrong results 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: Rounding Tips and Tricks

    Actually, the formula is working as intended. The problem is that I was testing the formula with different values for the length and forgot to set it back when copying...

    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 convert navarchar to datetime

    Use this at the beginning of your code:

    SET DATEFORMAT DMY;

    You probably have your server configured incorrectly, using the U.S. defaults.

    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: Find next date after a given date

    NineIron (9/23/2016)


    To be honest, I got hung up on the other solution. Luis's works out fine.

    Thanx.

    The other solution should work fine if you make the join an outer join. Depending...

    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 do I initialise a sql variable to 0 in stored-procedure ?

    Smendle (9/23/2016)


    I would love to get an official response from someone in the know on source code...

    1. Is a passed parameter treated as a variable once inside the stored...

    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: Basic insert for large tables

    Here's an example on how to do it.

    --Create the sample data

    CREATE TABLE Table1( n int);

    CREATE TABLE Table2( n int);

    WITH

    cteTally(n) AS(

    SELECT TOP 1000 ROW_NUMBER() OVER(ORDER BY...

    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: Are the posted questions getting worse?

    Phil Parkin (9/22/2016)


    Anyone in the mood for a quick code tidy-up?

    Hell NO!!!:crazy:

    What kind of tool wrote that code?

    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: Msg 245, Level 16, State 1, Line 2 Conversion failed when converting the varchar value 'F' to data type int.

    That's only a snippet. It's missing the SELECT.

    There's no way I'm going through all that code. Format it if you expect any help.

    All the results from a CASE expression should...

    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 do I initialise a sql variable to 0 in stored-procedure ?

    Smendle (9/22/2016)


    🙂

    thanks for all the replies I am smiling now because of you guys(or gals)!

    This is also why simple questions don't always have simple answers esp. for SQL.

    So my question...

    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 do I initialise a sql variable to 0 in stored-procedure ?

    Y.B. (9/22/2016)


    Sadly, you'd be surprise how often that is true.

    No, I won't. That's why I mentioned it. 🙁

    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 do I initialise a sql variable to 0 in stored-procedure ?

    Smendle (9/22/2016)


    Eirikur Eiriksson (9/22/2016)


    For a variable inside the procedure use this

    😎

    DECLARE @MY_INT_VAR INT;

    SET @MY_INT_VAR = 0;

    i could be confusing this with a .NET programming environment but doesn't that initialize 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: How do I initialise a sql variable to 0 in stored-procedure ?

    drew.allen (9/22/2016)


    Sue_H (9/22/2016)


    Luis Cazares (9/22/2016)


    Interview question?

    My thoughts as well. The follow up to that specific question could be interesting if someone doesn't know what would be different between the two.

    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

Viewing 15 posts - 2,131 through 2,145 (of 8,731 total)