Forum Replies Created

Viewing 15 posts - 4,846 through 4,860 (of 8,731 total)

  • RE: incement by 5 starting at 5

    It might not relate to the question directly, but if the number will be stored, this could be an alternative.

    CREATE TABLE #Increments(

    id5 int IDENTITY(5,5),

    ...

    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: New T-SQL Functions: How to modify an ORDER BY clause at run-time using a parameter

    I would go with something simple like:

    CREATE TABLE #Invoice

    (

    Invoice_Number int,

    Invoice_Date date,

    Item_Name varchar(40)

    )

    INSERT INTO #Invoice(Invoice_Number, Invoice_Date, Item_Name)

    SELECT 10001,...

    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 parse Flat File with varied Delimiters

    Could you post a sample of the file? Without real data and just enough rows to understand the different formats.

    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: Graph - just show last 12 months

    I believe that the formula to calculate the date is a little bit wrong.

    Here's an example according to what I understood:

    DECLARE @Date datetime= GETDATE()

    SELECT DATEADD(MM, DATEDIFF(MM, '19010101', @Date), '19000101'), --Using...

    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?

    Eirikur Eiriksson (6/3/2015)


    SQLRNNR (6/3/2015)


    Ed Wagner (6/3/2015)


    SQLRNNR (6/3/2015)


    Brandie Tarvin (6/3/2015)


    I am going to report ya'll to the USDA for pork chop abuse.

    I just thought you should know.

    Actually, these days it 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: Are the posted questions getting worse?

    Eirikur Eiriksson (6/3/2015)


    SQLRNNR (6/3/2015)


    Lynn Pettis (6/2/2015)


    SMH...

    Why would the person who wrote the procedure ask on a public forum why his procedure is returning a value of -6 when executed?

    Just tell...

    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: Combining Temp Table Results

    Hopefully, you did understand why were you getting an error and how the syntax works. CTEs and UNION (ALL) are part of a single statement and can't be divided 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: select string from []

    I'm including the code to retrieve the text between [] and avoid rows that won't contain a proper format. Feel free to modify it as needed and ask any 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: Combining Temp Table Results

    You have your syntax wrong. Additionally, CTEs won't work on SQL Server 2000 and previous.

    For 2005+ this syntax would work.

    Select columns

    into #tableA

    from SometableA

    where SomeCondition

    --order by --unnecessary

    ;

    Select columns

    into #tableB

    from SomeTableB

    where...

    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: A little complicated Query

    I assume that you mean a single statement when you mention "no stored procedure".

    Here's a possibility and I'm sure that there are many other ways to do it.

    DECLARE @TierId int...

    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?

    Lynn Pettis (6/2/2015)


    SMH...

    Why would the person who wrote the procedure ask on a public forum why his procedure is returning a value of -6 when executed?

    Is a well known fact,...

    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: Creation of random password which is easy to remember!!

    Why are you trying to reinvent the wheel? There are numerous password generators that will be able to follow different rules according to necessities (ensuring the use of upper 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: SQL Server DBA 101 Presentations

    This might probably won't help if you want something free, but the manga guide to databases explains databases in a great way for non-technical people and you could get ideas...

    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: Running totals with OVER clause

    Jason A. Long (6/1/2015)


    TheSQLGuru (6/1/2015)


    Thanks for that Jason!

    No problem. Thanks for kicking me in the back side to get it done... With the data partition and the select output. 😀

    When...

    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: Subtraction of values from consecutive rows

    I'm not sure if it's an improvement, just a fun way to save some keystrokes.

    SELECT

    SD.Id

    ,ABS(SUM(SD.Value*SIGN(Type-1.5))) AS Value

    FROM dbo.TBL_SAMPLE_DATA_012 SD

    GROUP 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

Viewing 15 posts - 4,846 through 4,860 (of 8,731 total)