Forum Replies Created

Viewing 15 posts - 7,591 through 7,605 (of 8,731 total)

  • RE: UNION Query help

    ScottPletcher (10/18/2013)


    T.Ashish (10/17/2013)


    Jeff Moden (10/17/2013)


    ScottPletcher (10/17/2013)


    Or just:

    ORDER BY 1

    I often avoid using the column names at all in UNIONed queries, as the names somehow seem to

    change a lot :-)...

    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: Removing '.' in SQL server table

    Maybe something like this would help.

    WITH SampleData(String) AS(

    SELECT 'ADB' UNION ALL SELECT 'ADC. DCD.' UNION ALL SELECT 'ADC.'

    )

    SELECT CASE WHEN RIGHT( String, 1) LIKE '[^A-Za-z0-9]'

    THEN LEFT( String, LEN( String) -...

    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: Get the First and Last Day of all the Months based on @ReportDate

    Could you give sample data and expected results?

    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: Converting table-value function to set based query

    I get to the same result, but I might be missing information from you.

    Will you always have 2 IDENT1 values? How would you show that?

    For additional values, you might need...

    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 safely secure Human Resources sensitive data?

    There's no need to create a schema. However, it would help you to manage the information. You can DENY premissions on specific objects. If you have a good user management,...

    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: Is there a way to do this?

    You're not grouping or using any aggregate functions. That might be your problem.

    Without some sample data, we might not be able to help you. Please read the article linked on...

    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: Getting Total Count for each month based on the Start and End Date

    Assuming also that both dates will be on the same year and months won't overlap. Otherwise a year column is also necessary.;-)

    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: Implicit conversion doesn't add cost

    Cost isn't a real performance indicator. It's just an estimated value used by the query optimizer to choose an execution plan.

    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: Getting Total Count for each month based on the Start and End Date

    You could add the MONTH and YEAR functions or a CONVERT to group by.

    SELECT RIGHT( CONVERT(char(11), FlightDate, 113), 8) Month,

    COUNT (PaxNum) as TotalPassengersCount

    FROM dbo.FlightDetails

    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: Sequence

    As far as I know, because I'm not that familiar with oracle either, Oracle doesn't have an Identity functionality as SQL Server has. That's why they use sequence.

    Looking for information...

    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: Determine number of files in a folder

    Just another option using dir parameters.

    DECLARE @cmd nvarchar(500)

    SET @cmd = 'dir C:\ /A:A'

    CREATE TABLE #DirOutput(

    files varchar(500))

    INSERT INTO #DirOutput

    EXEC master.dbo.xp_cmdshell @cmd

    SELECT COUNT(*)

    FROM #DirOutput

    WHERE files LIKE '[0-9][0-9]/%'

    DROP...

    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: Determine number of files in a folder

    I guess you're lacking of imagination. You just needed to adjust the temp table query.

    DECLARE @cmd nvarchar(500)

    SET @cmd = 'dir C:\'

    CREATE TABLE #DirOutput(

    files varchar(500))

    INSERT INTO...

    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 migrate a DTS package to SSIS

    You can still use DTS on 2008 but you would have to plan the migration (assisted by a tool or not) because 2012+ won't support them.

    My advice, don't trust migration...

    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: Determine number of files in a folder

    How about using dir?

    (untested code)

    DECLARE @cmd nvarchar(500)

    SET @cmd = 'dir C:\MyFolder\'

    CREATE TABLE #DirOutput(

    files varchar(500))

    INSERT INTO #DirOutput

    EXEC master.dbo.xp_cmdshell @cmd

    SELECT *

    FROM #DirOutput

    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: Sequence

    Drew Copenhaver (10/16/2013)


    OCTom (10/16/2013)


    Since I'm not using 2012, yet, I didn't know about SEQUENCE. So, I looked it up and found a nice Technet article by Denny Cherry.

    He not only...

    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 - 7,591 through 7,605 (of 8,731 total)