Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL SERVER 2008

SQL SERVER 2008

Scheduled Pinned Locked Moved Database
databasetutorialsharepointsql-serversysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jonhbt
    wrote on last edited by
    #1

    Hi, I need to use the

    sys.sp_cdc_enable_table procedure

    with the

    @schema, @source_name, @source_name

    parameters in a

    cursor

    but I can't find an example to follow. Can someone guide me with this with an example please? Thanks for your help. Regards

    T 1 Reply Last reply
    0
    • J jonhbt

      Hi, I need to use the

      sys.sp_cdc_enable_table procedure

      with the

      @schema, @source_name, @source_name

      parameters in a

      cursor

      but I can't find an example to follow. Can someone guide me with this with an example please? Thanks for your help. Regards

      T Offline
      T Offline
      Tim Carmichael
      wrote on last edited by
      #2

      Can you give a better description of what you are trying to do? Use some pseudo-code if necessary. Also, you listed your inputs as @schema, @source_name, @source_name (@source_name twice). Tim

      J 1 Reply Last reply
      0
      • T Tim Carmichael

        Can you give a better description of what you are trying to do? Use some pseudo-code if necessary. Also, you listed your inputs as @schema, @source_name, @source_name (@source_name twice). Tim

        J Offline
        J Offline
        jonhbt
        wrote on last edited by
        #3

        Hi, I have a list of table that I need to make them available for auditing by using that particular procedure. I had in mind to call that procedure in a cursor which identifies the table names, builds the script for that procedure by passing the table name and the source to the procedure and executes it. This procedure will be repeated for all the tables. This will avoid hard coding the procedure for all the tables (which I have over 150). Yes yu're right they should be as listed below;

        DECLARE Alter_tables_cursor CURSOR FAST_FORWARD
        FOR
        select table_name from information_schema.tables where table_name<>'dtProperties' and table_type<>'VIEW'
        OPEN Alter_tables_cursor
        DECLARE @tablename sysname
        FETCH NEXT FROM Alter_tables_cursor INTO @tablename
        WHILE ( @@FETCH_STATUS = 0 )
        BEGIN

        				EXECUTE 'sys.sp\_cdc\_enable\_table
        				@source\_schema = N''dbo'',
        				@source\_name = N''TBL\_ACTIVITY\_ACT'',
        				@role\_name = NULL'	
        			FETCH NEXT FROM Alter\_tables\_cursor INTO @tablename
        			END
        

        DEALLOCATE Alter_tables_cursor

        Thanks for your reply.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups