Forum Replies Created

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  • RE: I need help with this query.

    This makes no sense for me, but using the sample data previously posted, I can get the expected results with 2 options (none of them use SUM function).

    SELECT a.UserID,

    ...

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