Forum Replies Created

Viewing 15 posts - 1 through 15 (of 110 total)

  • RE: comparing two table structure

    Put a * or name some columns after the last select.

    For example,

    select * -- a.column_name or a.is_nullable etc

    from #a a

    left join #b b -- left/right/full...

  • RE: Select emails for all records

    The first example does not leave a trailing comma.

    For the second example, this should do:

    declare @email varchar(1000)

    set @email = ''

    select @email = @email + email + ','

    from #Friends_List

    where email is...

  • RE: Select emails for all records

    There are several posts on this site that address this sort of thing. Here are 2 ways.

    -- drop table #Friends_List

    GO

    create table #Friends_List (row int identity(1,1), email varchar(100))

    GO

    insert into #Friends_List select...

  • RE: How to make Print to Grid Default on opening new Query

    You want the General option, not the Results to Grid one.

    Tools > Options > Query Results > Sql Server > General > drop down "Default destination for results" > button...

  • RE: How to reseed identities in all tables

    Here's one method. Note the command is undocumented. Look around this site if you need more info on it. The NORESEED option is shown here to prevent someone from doing...

  • RE: Ignore Violation of PRIMARY KEY constraint

    You could use the ignore_dup_key option with a unique index and get a similar effect.

    create unique index ix_Uniq on MyTable (colA asc) with ignore_dup_key

    create table MyTable (colA int not null,...

  • RE: DataBase Structure

    Yes, making a relationship similar to the one you mention is a good way to go. It's certainly a better way than adding columns in your name table. You have...

  • RE: Job Interview Questions

    I agree with GSquared that the kind of questions to ask have to fit the sort of things you are going to ask the people to do.

    I'd be more interested...

  • RE: Getting all identity values in a batch insert statement.

    In Sql 2005 you can use the OUTPUT clause to write the new identities into another table. Here is a simple example. See BOL for better ones.

    create table #hdr (a...

  • RE: Getting all identity values in a batch insert statement.

    In Sql 2005 you can use the OUTPUT clause to write the new identities into another table. Here is a simple example. See BOL for better ones.

    create table #hdr (a...

  • RE: Deletion with LIKE Variable

    The first code you posted does work according to your requirements. From the sample data you posted there are no records in T1 that can be deleted. All of the...

  • RE: Showing column as decimal in select

    You did. Parentheses can make a difference.

    select datediff(n, '2009-06-30 20:37:16', '2009-06-30 20:49:00') / (datediff(n, '2009-06-30 05:00:00', '2009-06-30 10:00:00') * 1.0)

    should get you 0.0400

    An alternative is to explicitly convert one or...

  • RE: Error Creating format file for bcp

    Try it without the square brackets around the server name\instance.

    Also, -U -P and -T options are redundant. Use either -U with -P or -T by itself (although you can use...

  • RE: Error 701 There is insufficient system memory ...

    See BOL's topic "SQL Server Batch or Task Scheduling".

    The vendor's way made 47,000+ batches in one execution plan. That may have exhausted all of the available worker threads.

    Your method used...

  • RE: SQL Database Mail Log is Large

    see http://www.sqlservercentral.com/Forums/Topic527870-146-1.aspx, specifically Todd Engen's note.

    -- to remove mail more than a week old, this will do:

    DECLARE @SentBefore datetime

    SET @SentBefore = DateAdd(day, -7, DateAdd(day, DateDiff(day, 0, getdate()),...

Viewing 15 posts - 1 through 15 (of 110 total)