Forum Replies Created

Viewing 15 posts - 7,891 through 7,905 (of 8,731 total)

  • RE: TOP 1 for each employee

    You have a common solution that is used more often than you would expect.

    However, I have a question for you. Do you want a complete solution or just what...

    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 take backup of Single table and how to restore?

    udayroy15 (7/19/2013)


    Think export the table in xls then import it .........is the best solution

    Are you crazy?

    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: Can I join on an alias?

    Alan.B (7/18/2013)


    You can. It's hard to work with what you posted so I created the following sample code to demonstrate how you would join two tables in the way 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: Can I join on an alias?

    No, you can't because the alias doesn't exist when the JOIN is processed.

    More info: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/70efeffe-76b9-4b7e-b4a1-ba53f5d21916/order-of-execution-of-sql-queries

    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: Query help

    Eugene Elutin (7/18/2013)


    please note: use of cursor here is totally justified!

    It's justified, but my approach is shorter. Maybe I'm just lazy. 😀

    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: where filter col <> 0 returns error, col > 0 works, col contains no 0

    What do you get when you do this?

    SELECT B.Date

    FROM A

    INNER JOIN B

    ON A.ID = B.ID

    WHERE A.ID < 0

    You need to find out if there are any invalid dates in your...

    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: Query help

    You could use something like this.

    DECLARE @sql varchar(8000) = ''

    SELECT @sql = @sql + 'SELECT * FROM ' + QUOTENAME(name) + '..Docs WHERE (VirusStatus > 0) AND (VirusStatus IS NOT...

    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 two string Columns using a Function

    In the original function it's returned as ItemNumber instead of PosNo

    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 two string Columns using a Function

    Have you tried the 8K Splitter[/url]?

    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 an date from oracle to a regular datetime in sql

    If there are no leading zeroes for one digit day, here's an alternative.

    SELECT CONVERT( datetime2, PARSENAME(OraDate,4) + ':' + PARSENAME(OraDate,3) + ':' + PARSENAME(OraDate,2) + '.' + PARSENAME(OraDate,1))

    FROM (SELECT '25-JUN-13...

    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 an date from oracle to a regular datetime in sql

    Like this?

    SELECT CONVERT( datetime2, STUFF(STUFF(OraDate,13,1,':'),16,1,':'))

    FROM (SELECT '25-JUN-13 12.01.15.096000000 AM' AS OraDate) O

    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: Trying to join tables on different dates

    You can Unpivot your table to be able to join it.

    CREATE TABLE #Overtime_Budget_2013(

    [Org_Level] [nvarchar](50) NULL,

    [Overtime Code] [nchar](10) NULL,

    [January] [money] NULL,

    [February] [money] NULL,

    [March] [money] NULL

    )

    INSERT Into #Overtime_Budget_2013(Org_Level, [Overtime Code], January, February,...

    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: delete top 100

    Voide (7/17/2013)


    riya_dave (7/17/2013)


    hi

    my query is giving me erro

    delete top(1000) from table a

    join table b

    on a.id = b.id

    and b.date < getdate()

    error: incorrect syntax near a.

    i want to delete top 1000...

    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: delete top 100

    There's no need for an ORDER BY if the ultimate goal is to delete all the rows that follow that condition. However, a cycle will be needed. It's common 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: Trying to join tables on different dates

    Use DATENAME

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