Forum Replies Created

Viewing 15 posts - 18,136 through 18,150 (of 18,923 total)

  • RE: SQL Trigger

    Here's something that can help you :

    bcp pubs..authors2 in authors.txt -c -t, -Sservername -Usa -Ppassword -h "CHECK_CONSTRAINTS"

    BULK INSERT pubs..authors2 FROM 'c:\authors.txt'

    WITH (

    DATAFILETYPE = 'char',

    ...

  • RE: easy syntax question

    I would also suggest that you start using the best practice of naming the columns in the insert statement :

    Insert into dbo.MyTable (col1, col2, coln) select col1, col2, coln...

  • RE: Deleteing Old Data Automatically

    Delete from dbo.YourTable where DateCol < DateAdd(m, -18, getdate())

    You can then run this in a job whenever you need (just schedule de job to run whenever necessary).

  • RE: SQL Trigger

    R u using a bulk insert statement or just standard sql query?

  • RE: VIEW INSIDE A VIEW

    Actually UNION ALL doesn't remove dups, it's UNION that does that.

  • RE: Script to delete files older than x days?

    "LogFilePath.log", ForAppending, True /*create if not exists*/

    the 3rd parameter set to true means the the file will be created if it doesn't exists. So you don't need to do...

  • RE: Concatenation

    This is an exemple of how this trick can be converted to a function and then used in a select statement. But I agree with Kenneth that said that...

  • RE: Concatenation

    You set the variable @Job to an empty string, then you concatenate all the values that the select will return into that variable, then you can print/return/select the variable.

  • RE: INSERT Takes too Long

    Nice catch Ron... I had missed that one.

  • RE: Re: Syntax or IF statement

    no because when it is first evaluated, it is greater than 0, the value is reset after the if is evaluated.

    @MyRowcount is a different variable kept in another part of...

  • RE: INSERT Takes too Long

    That's a nice touch Noeld... but I think that the problems comes from the 50 delete statements that don't use any clustered indexes to do the deletes.. resulting in way...

  • RE: INSERT Takes too Long

    This could be cut to subsecond if you want my opinion.

    Is this what's going on??

    You have a live table where the info is kept.

    You have a staging table where new/updated...

  • RE: Re: Syntax or IF statement

    run this in Query analyser and you'll see the problem

    Select top 1 * from dbo.SysObjects

    Print @@Rowcount

    --1

    print @@Rowcount

    --0

    The rowcount variable is reupdated after the print statement. The 2nd time you...

  • RE: deleting records without writing to transaction log

    Thank god... I was hopping he was wrong cause a few of my backups would have been wrong :-).

  • RE: Need Help

    The table is created then dropped within the exec () statement

    try :

    set @sql = 'select * into #mytemp from ;

    SELECT * FROM #mytemp'

    exec (@sql)

Viewing 15 posts - 18,136 through 18,150 (of 18,923 total)