Forum Replies Created

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

  • RE: String manipulation

    A simple mechanism to cater for situations where more than one period (.) can appear in the emailaddress string try the following:

    DECLARE @EmailAddress VARCHAR(50)

    SET @EmailAddress = 'firstname.lastname@test.org'

    SELECT SUBSTRING(@EmailAddress,1,

    ...

  • RE: Best process to copy then delete rows

    In your example you reference a column in the source table called "id".

    If this is the primary key with new rows getting a sequentialy allocated value then you could...

  • RE: Bcp utility error

    In you BCP command line you specify line 2 as the first line but if you look in the sample .txt file the column headers appear on row 2 as...

  • RE: SQL Agent jobs logging

    To quickly see where SQL Server is going to (if at all) create the maintenance plan log files open up Management Studio and edit the Maintenance Plan.

    In the tabbed...

  • RE: Query Help

    In you GROUP BY statement you are using the txtName column value but the select performs a CASE statement to turn the different values into 'yes' or 'no' for Group...

  • RE: EXTRACT THE DATA FROM DB ....

    If you can take advantage of VARCHAR(MAX) then the following SQL will remove the need for any kind of manual 'loop':

    DECLARE @sql VARCHAR(MAX)

    SET @sql = ''

    SELECT...

  • RE: sys.dm_db_index_usage_stats

    Entries only appear in the DMV after the index is used for the first time.

  • RE: Records missing

    This has a Begin and Rollback transaction.

    Are you actually specifying a COMMIT in your code?

  • RE: Systax Error

    You have not supplied a value for the @Level3 variable so the 2nd IF statement will be false just like the 1st one.

  • RE: BACKUPSET having entry with another Server_name and Machine_name

    Restore operations have entires in the msdb.dbo.restorehistory table so you can filter them out of the backupset table based on a join on backup_set_id.

    The SQL snippet below is something that...

  • RE: Order by the date

    I might be missing something here, but I took your SQL and created a test table and populated with the date values you suggested:

    CREATE TABLE #data ([datecolumn] datetime)

    INSERT INTO #data...

  • RE: sql server stored procedure

    Not sure this is what you are after but the following syntax will create you a stored procedure taking a table name as input and will output the contents:

    CREATE PROC...

  • RE: SARGable

    SandyDB (2/26/2010)


    Non-sargable search arguments in the WHERE clause, such as "IS NULL", "<>", "!=", "!>", "!<", "NOT", "NOT EXISTS", "NOT IN", "NOT LIKE", and "LIKE '%500'" generally prevents (but not...

  • RE: Selecting Individual values from a table

    Hi,

    I spent a couple of minutes putting together a dynamic SQL solution to your problem. Hopefully I have understood what you are looking for.

    What you need to do is set...

  • RE: COPY_ONLY Backups

    Thanks for information.

    I use COPY_ONLY backups if I need to take an ad-hoc copy of a production database for urgent debugging in a development environment without interrupting the current backup...

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