Dynamically script Create Database For Attach For All Databases

  • David Benoit

    SSC-Dedicated

    Points: 34562

    Comments posted to this topic are about the item Dynamically script Create Database For Attach For All Databases

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • Mohamed.Koker

    Grasshopper

    Points: 20

    Will this script work for databases using the FILESTREAM feature in SQL Server 2008?

  • David Benoit

    SSC-Dedicated

    Points: 34562

    I did not include that in this design but could look into that as well.

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • Mohamed.Koker

    Grasshopper

    Points: 20

    Thx!

  • Jim P.

    SSCrazy Eights

    Points: 8725

    Sweet code.

    On the

    SELECT @a = (SELECT SUBSTRING(@a,1,LEN(@a)- 1))

    --Trim off the final comma; I'm sure there is a better way to do this...

    Why not just do a

    SELECT @a = LEFT(@a,LEN(@a)- 1)



    ----------------
    Jim P.

    A little bit of this and a little byte of that can cause bloatware.

  • David Benoit

    SSC-Dedicated

    Points: 34562

    A lot of the code is sourced from another script posted by another user on the site. I reference the original script when I posted my version so that proper credit could be given. That particular section of code came with the original script. I will look at adding that in my version though. Thanks for the suggestion!

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    Thanks for the script.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply