Forum Replies Created

Viewing 15 posts - 856 through 870 (of 13,469 total)

  • RE: carriage return in stored proc

    you are doing it correctly, but it depends on what is doing the presenting.

    In Grid mode in Management Studio, CrLf are ignored(converted to spaces) FOR PRESENTATION ONLY, if you copy...

  • RE: Restrict access on single database from admin user

    SQL_Student (8/29/2016)


    Thanks I tried that, but if user has sysadmin role he still has access to the db 🙁

    in general, If someone has sysadmin access, you cannot restrict access to...

  • RE: Views not changing when table changes

    when the view is actually compiled, the wild card is expanded to the list of actual column names in the compiled version of the view;that's to avoid dynamically having to...

  • RE: Job to Back Up DB structures only

    there's a number of powershell scripts that use SMO to script out all objects as well;

    you could easily set something up to call that on a regular basis.

    I'll see if...

  • RE: SQL database files

    tobypaul509 (8/23/2016)


    What is the best tool in terms of efficiency, cost and success rate for repairing and recovering corrupt SQL 2005 database files?

    I need to purchase a tool for my...

  • RE: How to prevent a table from being truncated or dropped

    ChrisM@Work (8/23/2016)


    JasonClark (8/23/2016)


    Try to run the below code to prevent accidental delete:

    CREATE TRIGGER [TR_ProtectCriticalTables]

    ON DATABASE

    FOR

    DROP_TABLE

    AS

    DECLARE @eventData XML,

    @uname NVARCHAR(50),

    ...

  • RE: Extended Event DDL and Filter out Temp tables?

    GilaMonster (8/22/2016)


    Try filtering on database_id, or is the db_id the id of the connection rather than the table?

    doh simple and obvious;

    the database_id =2 , regardless of what database context that...

  • RE: Execution Plan Question

    whenever the difference between estimated rows and actual rows is off by a lot(order of magnitude or more,

    it usually means the statistics are out of date enough to adversely affect...

  • RE: SQL backup Script is appending instead of overwriting

    it's an easy fix.

    change the NOINIT TO INIT

    that is append vs create/overwrite.

    mwinn (8/11/2016)


    I have been running this Backup script for several years but yesterday I had to transfer the database...

  • RE: Replace commas from all columns in a Table (Just one table)

    the data is the data. don't modify the data, modify the query that is exporting to csv.

    if you use SSIS, you can modify it to export everything with double...

  • RE: Rename Column with comma

    i think you want something like this:

    SELECT

    'exec sp_rename ''' + QUOTENAME(Table_Name) + '.' + QUOTENAME(REPLACE(COLUMN_NAME,'''','''''')) +

    ''', ''' + QUOTENAME(LOWER(REPLACE(COLUMN_NAME,'''',''''''))) + ''', ' + '''COLUMN'';'

    FROM

    Information_Schema.[COLUMNS]

    WHERE COLUMN_NAME <>...

  • RE: Rename Column with comma

    any object name with a single quote in it needs to be escaped in a command:

    exec sp_rename '[table_name].[Rec''d 2007]', '[rec''d 2007]', 'COLUMN';

  • RE: t-sql 2012 use a trigger

    TheSQLGuru (8/7/2016)


    If you do this with a trigger, you MUST make it asynchronous!! I would either put the necessary information into a simple queue-style table or use SQL Server Service...

  • RE: t-sql 2012 use a trigger

    Does the existence of duplicates actually break anything, or is it just a cleanup task because the .net application doesn't check for duplicates before adding the data? the urgency is...

  • RE: ISNULL function does not allow concatenating CHAR's in SQL 2008R2 or earlier

    wow Line 74851

    thats a huge proc to debug.

    at that size, it must be doing a zillion things, that's rough.

Viewing 15 posts - 856 through 870 (of 13,469 total)