Forum Replies Created

Viewing 15 posts - 1,291 through 1,305 (of 1,314 total)

  • RE: Query to get first number

    How about this:

    DECLARE @NewBudgetID INT

    IF (Select Min(BudgetID) as NewBudgetID from tblBudgetYear) > 1

    Set @NewBudgetID = 1

    ELSE

    Select @NewBudgetID = top 1 BudgetID + 1 from tblBudgetYear x

    where not exists(Select NULL from...

  • RE: T-SQL "shortcut"?

    5409045121009's solution is a derived table, not a correlated subquery. The F(..) that looks like a function is the table alias of the derived table. It's just like...

  • RE: DTS Lawsuit

    You are using the graphical DTS designer when you work with DTS packages in Enterprise Manager, but they are actually run by the DTSRUN utility which has no licensing requirement....

  • RE: Copy tables and logins

    If you selected "Copy object-level permissions" it would not do anything evil, but you must have the same logins set up in the source and destination databases. This will...

  • RE: Alter table problem

    I would certainly try the other solutions that have been suggested first, but if you really need to modify a large table on a disk-space-limited system, you may have to...

  • RE: Force similar strings to be the same

    I use an ActiveX component called ActiveGender for this. It only costs $250, and it can deal with a lot of variations like hyphenated names, multi-part names, etc. ...

  • RE: Ignoring DupeKey Errors on Bulk Insert

    According to BOL, if you include the IGNORE_DUP_KEY option on a CREATE UNIQUE INDEX statement (clustered or nonclustered), you will get a warning for duplicate key values but the non-duplicate...

  • RE: Alter user-created system function

    You can't edit the function after you it is owned by system_function_schema. You will also have trouble viewing the function in Enterprise Manager or any SQL_DMO based application.

    You must...

  • RE: Triggers and multiple row updates

    Don't forget to handle NULLS:

    WHERE ISNULL(d.dtmScheduledDate,'1/1/1980') <> ISNULL(wom.dtmScheduledDate,'1/1/1980')

  • RE: Triggers and multiple row updates

    You can select the updated rows without a cursor:

    SELECT PrimaryKey, refno FROM inserted WHERE UPDATE(refno)

    or

    SELECT PrimaryKey, d.refno as Before, i.refno as After

    FROM inserted i

    INNER JOIN deleted d on i.PrimaryKey =...

  • RE: Bad practices

    Really bad practice - assuming web hosting companies know how to set up SQL Server boxes.

    This is the second company I've been at where the hosted SQL servers were set...

  • RE: TLog maint plan fails to delete old files

    That seems to have done the trick. The report now has a batch of "Delete old backup files..." lines after the backup & verify section.

    It will be a shame...

  • RE: TLog maint plan fails to delete old files

    There are no errors in the reports.

    This is a generic maintenance plan to backup all databases, so it also applies to system dbs. The transaction log backup statements for...

  • RE: Bad practices

    How about manual ad-hoc changes to production data?

    I worked for a company that used a web-based system to handle used car sales between leasing companies and wholesale dealers. We...

  • RE: Bad practices

    My first exposure to triggers was trying to debug triggers left behind by some whacko they had gotten rid of. He had error handling built into all the triggers...

Viewing 15 posts - 1,291 through 1,305 (of 1,314 total)