Forum Replies Created

Viewing 15 posts - 2,476 through 2,490 (of 8,731 total)

  • RE: How do I add a constraint to a column

    mw112009 (7/20/2016)


    To: RVARN:

    Example -

    ALTER TABLE employees

    ADD CONSTRAINT check_value

    CHECK (fieldname IN ('Y', 'N', NULL));

    --The above does not work. It allows any value. The trick is you need to take...

  • RE: URGENT Please -Substring Formation in SQL SERVER 2014

    Here's another option with an additional validation for strings without digits.

    SELECT col1

    ,LEFT( PartialString, CHARINDEX( ' ', PartialString + ' '))

    FROM ...

  • RE: How do I add a constraint to a column

    RVarn (7/20/2016)


    The basic syntax is this -

    ALTER TABLE table_name

    ADD CONSTRAINT constraint_name

    CHECK (column_name condition);

    Example -

    ALTER TABLE employees

    ADD CONSTRAINT check_value

    CHECK (fieldname IN ('Y', 'N', NULL));

    Example-

    ALTER TABLE...

  • RE: How do I add a constraint to a column

    Ever thought about using a bit column?

  • RE: Side by side upgrade question

    From BOL


    Any scenarios not specified in the list above are not supported, including but not limited to the following:

    Installing SQL Server 2005 and SQL Server 2016 on same computer (side...

  • RE: Are the posted questions getting worse?

    Sean Lange (7/19/2016)


    Ray K (7/19/2016)


    jasona.work (7/19/2016)


    You know, this was probably not a good comment, so I'm dumping it...

    Instead, who's going to see Star Trek this weekend!

    My wife is dying to...

  • RE: Side by side upgrade question

    Is it possible? Maybe

    Is it supported? No.

    https://msdn.microsoft.com/en-us/library/ms143393.aspx

  • RE: Identical Query, Different Execution Stats

    Have you checked fragmentation?

  • RE: online script full of odd quotation marks

    Apparently, the quotes and minus signs were modified by a word processor.

    Here's a corrected version after performing 4 Replace All.

    USE master

    GO

    PRINT '*******************************************************************************************'

    PRINT '*******************************************************************************************'

    PRINT '<SQL Server Instance Name>'

    SELECT @@SERVERNAME

    GO

    PRINT '*******************************************************************************************'

    PRINT '*******************************************************************************************'

    PRINT...

  • RE: Are the posted questions getting worse?

    Not a fan of Star Trek (and I guess my wife is grateful for that), so we're going to watch Ice Age instead.

  • RE: need t-sql query

    JohnNash (7/19/2016)


    Tweaked a bit to suit my requirement and it worked. Thank you Luis Cazares

    Just be sure to understand it completely and ask any questions that you might have. 😉

  • RE: Are the posted questions getting worse?

    Congratulations Brandie! Now ask for vacations 😀

  • RE: -5 Hours from HH:MM:SS

    Or the input.

    Or cast the output as string, but don't do this, unless you don't plan on doing anything else with this data.

    SELECT DATEADD(HOUR,-5, CAST('12:00:01' AS time)) AS cast_input,

    ...

  • RE: -5 Hours from HH:MM:SS

    Use DATEADD()

  • RE: need t-sql query

    shirolkar.anand (7/19/2016)


    Hi,

    you can try with below approach-

    declare @t table(Parent_ID char(1),Child_ID char(1))

    insert @t values ('A','B'),('C','D'),('B','C'),('B','E'),('E','F')

    select t1.Parent_ID,t1.Child_ID,isnull(t2.count+t3.t3_cnt,1) Level from @t t1 left join

    (select Parent_ID,count(Child_ID)count from @t group by Parent_ID) t2

    on t1.Parent_ID=t2.Parent_ID

    left join...

Viewing 15 posts - 2,476 through 2,490 (of 8,731 total)