Forum Replies Created

Viewing 15 posts - 2,866 through 2,880 (of 8,753 total)

  • RE: Current options for data-change notification on a vendor-schema (unalterable)

    Another option I've been using for similar purposes is the dynamic management view sys.dm_db_index_usage_stats, monitoring the changes in user_updates using last_user_update and index_id < 2 to limit the output. The...

  • RE: Current options for data-change notification on a vendor-schema (unalterable)

    mister.magoo (11/7/2016)


    mister.magoo (11/7/2016)


    Documentation is slippery... but here is the event

    select p.name, p.description, o.name, o.description

    from sys.dm_xe_objects o

    join sys.dm_xe_packages p

    on p.guid = o.package_guid

    where p.name='sqlserver'

    and o.name like 'table_update_code_path'

    I have to say though -...

  • RE: Username increment by 1 if already exists in table

    David Burrows (11/7/2016)


    WITH x (ID,FirstName,LastName,UserName,UserNum) AS (

    SELECT e.ID,e.FirstName,e.LastName,LEFT(e.FirstName,t.N)+e.LastName,

    ROW_NUMBER() OVER (ORDER BY LEN(LEFT(e.FirstName,t.N)+e.LastName) ASC,LEFT(e.FirstName,t.N)+e.LastName ASC,ID ASC)

    FROM #Employee e

    JOIN master.dbo.Tally t ON t.N BETWEEN 1 AND LEN(e.FirstName)

    WHERE NOT EXISTS (SELECT * FROM...

  • RE: Username increment by 1 if already exists in table

    Here is a solution that works according to the current;-) requirements. It has a limitation of the first name being 30 characters or shorter, don't think that is going to...

  • RE: SQL Agent Token and Ola H scripts

    MiguelSQL (11/7/2016)


    Ate you talking about the comnandlog table?

    It didn't have enough detail as the log file

    It has all the backup file names, error code, error number, did you need any...

  • RE: Need help with a SQL "least significant digit" algorithm

    Simple "set" based approach

    😎

    USE TEEST;

    GO

    SET NOCOUNT ON;

    IF OBJECT_ID(N'tempdb..#mytab') IS NOT NULL DROP TABLE #mytab;

    create table #mytab (origval varchar(max))

    insert #mytab values

    ('1.2'), --should convert to 1.3...

  • RE: How to use a CSV as parameter in a query

    Henk Schreij (11/7/2016)


    @ "Another question, how frequently will this be called?"

    Not so often:

    From March till August at max a 100 times per hour. Rest of the year almost never.

    Then this...

  • RE: Determine if a table column is used?

    Eric M Russell (11/7/2016)


    Eirikur Eiriksson (11/7/2016)


    Eric M Russell (11/4/2016)


    Or you could leave the columns as is and add page compression, which in this case would probably shrink the table down...

  • RE: How to use a CSV as parameter in a query

    You are very welcome

    😎

    Another question, how frequently will this be called?

  • RE: Table valued fucntion or scalar valued function

    sqlfriends (11/7/2016)


    front end .net developers

    :exclamation: hopefully those are not doing any sql development :exclamation:

    😎

  • RE: A Better sp_Spaceused

    Jeff Moden (11/7/2016)


    Eirikur Eiriksson (11/7/2016)


    Jeff Moden (11/6/2016)


    Geez... it would have been SOOOOOOOO simple for them to make the "improvement" so much more worthwhile. I don't know why they even...

  • RE: SQL Agent Token and Ola H scripts

    I find it easier to log the output of the OH scripts to a table and work from there.

    😎

  • RE: How to use a CSV as parameter in a query

    One option is to use XML, here is a simple example

    😎

    USE TEEST;

    GO

    SET NOCOUNT ON;

    DECLARE @PARAXML XML = '<X>1</X><X>2</X><X>3</X><X>4</X><X>5</X>';

    SELECT

    P.DATA.value('(./text())[1]','INT') AS PARAM_VALUE

    FROM @PARAXML.nodes('/X') P(DATA);

    Output

    PARAM_VALUE

    -----------

    1

    2

    3

    4

    5

    Quick question, how many parameter...

  • RE: Username increment by 1 if already exists in table

    David Burrows (11/7/2016)


    Notwithstanding Eirikur's statement re same first names

    WITH x (ID,FirstName,LastName,UserName,RowNum) AS (

    SELECT e.ID,e.FirstName,e.LastName,LEFT(e.FirstName,t.N)+e.LastName,

    ROW_NUMBER() OVER (PARTITION BY e.ID ORDER BY LEN(LEFT(e.FirstName,t.N)+e.LastName) ASC)

    FROM #Employee e

    JOIN master.dbo.Tally t ON t.N BETWEEN 1...

  • RE: Determine if a table column is used?

    Eric M Russell (11/4/2016)


    Or you could leave the columns as is and add page compression, which in this case would probably shrink the table down to 10% or less of...

Viewing 15 posts - 2,866 through 2,880 (of 8,753 total)