Forum Replies Created

Viewing 15 posts - 7,171 through 7,185 (of 7,608 total)

  • RE: Trigger to concatenate two columns and update in new column

    Agreed.

    For example:

    ALTER TABLE dbo.tablename

    DROP COLUMN Full_Name;

    ALTER TABLE dbo.tablename

    ADD Full_Name AS CAST(ISNULL(F_Name + ' ', '') + ISNULL(Lname, '') AS varchar(100))

    -- change 100 to whatever max length you want for...

  • RE: T-SQL Help Needed

    Jeff Moden (9/20/2012)


    SomewhereSomehow (9/20/2012)


    That a person is in wikipedia means that he is notorious enough that someone thought to write of him.

    It is also possible that person wrote about themselves...

  • RE: T-SQL Help Needed

    SomewhereSomehow (9/20/2012)


    Evil Kraig F (9/20/2012)


    Perhaps, I've been accused of optimism before... rarely, but it's happened. I'm sorry to hear your political system is falling apart however.

    Actually it is...

  • RE: T-SQL Help Needed

    GSquared (9/20/2012)


    SomewhereSomehow (9/20/2012)


    Nope. Not going to taint you with my personal opinions regard Mr. Celko. Too bad he is a co-author with Itzik on a book as I...

  • RE: ms standards doc?

    sqlguy-736318 (9/19/2012)


    I think it's unfortunate that MS doesn't provide an automated tool to review a SS database for standards compliance. The nice thing about FXCop is that it's somewhat...

  • RE: ms standards doc?

    Lynn Pettis (9/19/2012)


    Also, don't name your procedures with "sp_" as you may run afoul of a Microsoft system stored procedure of the same name.

    Quite true! In fact, don't start...

  • RE: ms standards doc?

    I think MS had that at one point but they dropped it.

    In general, carefully determine rules among yourselves and

    most of all, consistently follow them.

    FWIW, here are my...

  • RE: Count number of rown in transaction without adding to a parameter?

    If you want/need EXEC() (vs sp_executesql), then you can use a temp table to return the row total:

    DECLARE @sql VARCHAR(2000)

    CREATE TABLE #result ( total_rows int )

    SET @sql = 'DECLARE...

  • RE: Count number of rown in transaction without adding to a parameter?

    SQLKnowItAll (9/19/2012)


    Here's some sample code:

    CREATE TABLE #test(id int identity (1,1), filler VARCHAR(1))

    GO

    INSERT INTO #test(filler)

    SELECT 'a'

    GO 5

    DECLARE @sql VARCHAR(150)

    SET @sql = 'BEGIN TRAN SELECT * FROM #test SELECT * FROM...

  • RE: Count number of rown in transaction without adding to a parameter?

    Sean Lange (9/19/2012)


    SQLKnowItAll (9/19/2012)


    Here's some sample code:

    CREATE TABLE #test(id int identity (1,1), filler VARCHAR(1))

    GO

    INSERT INTO #test(filler)

    SELECT 'a'

    GO 5

    DECLARE @sql VARCHAR(150)

    SET @sql = 'BEGIN TRAN SELECT * FROM #test SELECT...

  • RE: T-SQL Help Needed

    Eugene Elutin (9/19/2012)


    ScottPletcher (9/19/2012)


    Eugene Elutin (9/19/2012)


    ...

    ISO currency and Country codes are a prime example of an when the natural key (ISO Code) can be used as an Identity column and...

  • RE: T-SQL Help Needed

    Eugene Elutin (9/19/2012)


    ...

    ISO currency and Country codes are a prime example of an when the natural key (ISO Code) can be used as an Identity column and Primary Key.

    ...

    You wouldn't...

  • RE: Check SQL Version

    I would use @@VERSION for that, because you can get the SQL version year, and then it's more self-evident about what you're checking:

    DECLARE @isSqlServer2008 bit

    SET @isSqlServer2008 = CASE WHEN...

  • RE: Cursor within triggers...

    Definitely don't use a cursor.

    But you could pass all the values at once as a table-valued parameter; you just need to modify the code of the sp to handle a...

  • RE: T-SQL Help Needed

    Lowell (9/18/2012)


    i just tripped over this exact lack of planning by the database architect when switching from one insurance agency to another. From Geico to Progressive: I saved 30% or...

Viewing 15 posts - 7,171 through 7,185 (of 7,608 total)