Forum Replies Created

Viewing 15 posts - 4,246 through 4,260 (of 8,731 total)

  • RE: Today's Random Word!

    Ed Wagner (9/9/2015)


    crookj (9/9/2015)


    Jim_K (9/9/2015)


    ZZartin (9/9/2015)


    eccentricDBA (9/9/2015)


    BWFC (9/9/2015)


    Eirikur Eiriksson (9/9/2015)


    whereisSQL? (9/9/2015)


    Classy

    Glossy

    Magazine

    cartridge

    Cartilage

    Shark

    Jaws

    Sea

    World

    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 written by a beginner

    SQLPain (9/8/2015)


    Thank you guys for all your help !!!

    Would the following 2 statements fetch the same result?

    1)AND (CC.EndDate >= H.SysDateTime OR (CC.EndDate IS NULL AND GETDATE() >= H.SysDateTime))

    2)AND ISNULL(CC.EndDate, GETDATE())...

    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: Dynamic Query to Print out the resultset from a table

    Sorry, I understood that you needed to print, copy and execute the code.

    You can concatenate all the commands in a single string. This article explains how to do it: http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    DECLARE...

    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 syntax help - this should be simple

    sgmunson (9/8/2015)


    Luis Cazares (9/8/2015)


    sgmunson (9/8/2015)


    Based solely on the original post, only the GROUP BY portion of your query is actually needed:

    It depends on the expected output. My code will return...

    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: First Occurance of the string from text

    Don't you love the disappearing OPs?

    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: Dynamic Query to Print out the resultset from a table

    Why don't you simply display the results as text instead of a grid?

    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' conditions

    SQLAddict01 (9/8/2015)


    I have so many NOT IN conditions like ::

    Select * from backups

    where

    databasename not in (select databasename from backups where servername...

    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 @@rowcount be overwritten?

    You just accumulate the row counts. Be sure to initialize your variable to zero to avoid getting a null value.

    while

    process a chunk

    set @p_affected_rows =...

    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' conditions

    Either you can write your query like this:

    SELECT *

    FROM Test

    WHERE NOT( ServerName = 'D900'

    AND DatabaseName = 'Test1')

    Or you could tell us how do you define the first row. Remember...

    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 written by a beginner

    The subqueries make no sense as they're not tied to anything from the outside. You're probably after something simpler as this:

    DECLARE @Start datetime,

    @End datetime;

    SELECT @Start =...

    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: First Occurance of the string from text

    This seems to return the same results as Jeff's code without the need of a tally table.

    SELECT tt.*, new.String

    FROM #MyHead tt

    CROSS APPLY (SELECT SUBSTRING( pString, PATINDEX('%A[^BCD]%', pString), 8000)) Start(tString)

    OUTER APPLY...

    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 syntax help - this should be simple

    sgmunson (9/8/2015)


    Based solely on the original post, only the GROUP BY portion of your query is actually needed:

    It depends on the expected output. My code will return all the rows...

    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: Find string with spaces and replace them with other string

    andreakreif (9/8/2015)


    This will also replace all temp table creates.

    CREATE TABLE #SomeTable becomes ALTER TABLE #SomeTable.

    Like Luis said, this is not an automated process.

    Seems like regular expressions with patindex might work....

    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: Save query results directly using variables and date/time

    Jeff Moden (9/4/2015)


    Luis Cazares (9/2/2015)


    You also need to be sure about the server name you're using.

    Nicely done, Luis.

    Just a tip... if it all occurs on the server itself, you don't...

    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: Need Windowed Partitioning Help

    Want a cool Sig (9/4/2015)


    DATEADD( YY, DATEDIFF(YY, 0, @Date),0)

    Hi Luis, I've never seen this before and I don't see it in the online documentation... how does it work? I...

    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,246 through 4,260 (of 8,731 total)