Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    1

    Unanswered: replication - post snapshot script

    hello,

    is it somehow possible to pass a variable like a database name into a post snapshot script.

    i would need to pass a database name into the post snapshot script when creating the replication with sqlcmd.

    where the create publication looks like this:
    exec sp_addpublication @publication = ... ,@post_snapshot_script = N'$(SnapshotScriptPath)\PostSnapshot.sql',...

    and i would need to somehow pass the dbname as a variable in the postsnapshot script.

    in the postsnapshot.sql i would then need to set:
    use [$(dbname)]

    thanks,
    Chris

  2. #2
    Join Date
    Jan 2010
    Location
    Alaska
    Posts
    3
    cant you use db_name? IE @dbname [test] = 'test' something to that affect.

    normally you use select db_name as [current database]

    but you could do...

    select db_name(test) as [test] or whatever.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •