Forum Replies Created

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

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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),

    ...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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 <>...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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';

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • 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.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Linked Server Update "Hung"

    i think it would be like this, right?

    DECLARE @TermToTweak VARCHAR(30) = 'lowell@fake.com'

    DECLARE @cmd VARCHAR(MAX) = 'EXECUTE AT(LinkedServer,''update P

    set P.Email1 = ''' + @TermToTweak + '''

    from MyDatabase.dbo.Profiles P

    JOIN MyDatabase.dbo.Complaints C on...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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