Forum Replies Created

Viewing 15 posts - 3,631 through 3,645 (of 8,731 total)

  • RE: Need help constructing this SQL Statement, against one table only (table with three columns)

    Be aware that an identity column might have gaps, so you might need to create an artificial key.

    Something like this:

    WITH cteLog AS(

    SELECT ROW_NUMBER() OVER(ORDER BY SNum...

    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: Next Payment Month using Start Month, Frequency and Current Month

    I'm sorry, change the 12 in the where clause to use file month column.

    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: Next Payment Month using Start Month, Frequency and Current Month

    This will return the data with the current table design. I agree with John on correcting the data types, but I understand that sometimes is not possible. If at all...

    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: Using SELECT as 'IN' predicate condition for PIVOT

    matt.warren 33350 (12/21/2015)


    Hello Luis,

    I can't thank you enough for all your help.

    I ran into some errors with the code you helped me with, but having seen your advice, it makes...

    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?

    BL0B_EATER (12/21/2015)


    Ahhh I wanted to see a light saber! 🙂

    It doesn't apply, but lightsabers were banned in some theaters in the US. Others just banned masks and blasters. That's so...

    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: ***SPOILER FREE*** Star Wars: The Force Awakens

    I wouldn't rate it as high. I felt it was just a mashup of the previous movies. Taking so many elements of the previous movies made it predictable.

    I had a...

    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: Using SELECT as 'IN' predicate condition for PIVOT

    Or you could use cross tabs instead of pivot.

    DECLARE @sql nvarchar(max),

    @Params nvarchar(4000);

    SET @Params = N'@VolumeParam int,

    @RegStartQtrParam int,

    @RegStartYearParam 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: Parse the username in the string T-SQL

    This might be simpler.

    SELECT LEFT( trunc.message, CHARINDEX(' ', trunc.message)), *

    FROM dbo.sysjobhistory jh

    CROSS APPLY( SELECT SUBSTRING( message, 49, 4000)) trunc(message)

    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: Pivot query using dates between 2 dates

    I'm sorry, I've been busy, but I'll try to explain.

    The following code is a common way to create a tally table on the fly. It will generate zero reads, so...

    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: Give me suggestions for DBA interview

    eluriraja (12/16/2015)


    WHAT TYPE OF QUESTIONS IS THERE CHANCES TO ASK.....?

    One question could be:

    Tell me about your experience. What did you do on your previous job? What problems did you...

    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: Pivot query using dates between 2 dates

    This is the approach I would take. I wouldn't store this result in a table as this would be a waste of storage. This should be for display purposes 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
  • RE: Convert Rows into Columns

    sivaj2k (12/16/2015)


    Here is simple way of getting the output.

    ...

    Regards

    Siva 🙂

    Only if you can be sure that there won't be any gaps. In the real world, that's unlikely to happen.

    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: Parse string from URL between...

    Sergiy (12/13/2015)


    Luis Cazares (12/9/2015)


    This should be safer.

    declare @URL varchar(100) = 'http://www.mydomain.info/Customer.aspx?dcc=EUR&h_hmid=2907831&mobiredirect=no&cpn=3790'

    SELECT *, LEFT( initial.pos, CHARINDEX( '&', initial.pos + '&') - 1)

    FROM (VALUES (@URL)) AS x(url)

    CROSS APPLY (SELECT SUBSTRING( x.url, CHARINDEX('h_hmid=',...

    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: what is the best way to rewite a oracle sql query to sql server 2012

    In SQL Server you don't have to enable constraints. They're enabled by default.

    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: what is the best way to rewite a oracle sql query to sql server 2012

    The code you attached is just creating some tables. The syntax is very similar, remove the double quotes, adjust the data types (varchar2 to varchar, timestamp to datetime, number 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

Viewing 15 posts - 3,631 through 3,645 (of 8,731 total)