Results 1 to 6 of 6

Thread: Problem Attaching SQL Server Database file

  1. #1

    Thread Starter
    Hyperactive Member oyad's Avatar
    Join Date
    Feb 2003
    Location
    PhoxWare MicroSystems
    Posts
    463

    Problem Attaching SQL Server Database file

    plz, there is something strange i noticed while attaching sql server database. Am attaching from my VB code. when i place the database file on my c: drive(or any directory within this drive),it gets attached to my sql server instance(am using sql server 2005 express edition and run windows XP). But when i placed the database file in My Document, it doesn't get attached.I tried using my sql server management studio. i can locate the database file when i tried attaching it from c: drive but the node for My Documents folder cannot be expanded (actual path is "C:\Documents and Settings\Oyad\My Documents"). Cannot file reside in My Documents folder?
    Nobody is smarter than all of us!

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Problem Attaching SQL Server Database file

    Well, a database is not a document so even if it could be in MyDocuments, it shouldn't be.

    May I ask why you want to put it there?

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Problem Attaching SQL Server Database file

    Are you using the actual path - the C:\Documents and Settings\Oyad\My Documents path?

    Or are you trying to use the virtual folder "My Documents"?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4

    Thread Starter
    Hyperactive Member oyad's Avatar
    Join Date
    Feb 2003
    Location
    PhoxWare MicroSystems
    Posts
    463

    Re: Problem Attaching SQL Server Database file

    Quote Originally Posted by szlamany
    Are you using the actual path - the C:\Documents and Settings\Oyad\My Documents path?

    Or are you trying to use the virtual folder "My Documents"?
    Its actually i web application i did 4 a friend & he extracted into his document folder (My Document) ,along with d application ,i created a small windows application 4 him 2 attached d database but d database was not attaching, i then came down personally 2 fix d problem, installed SSMS & tried attaching, right -click on databases node in object explorer windows, selecting Attach..,d Attach database window comes up, i clicked on Add button,using Locate Datafile tool, Oyad node under Documents and Settings cant b expanded too.
    The small windows program i wrote is using d full path (using Open dialog) to attach d file. Its attaches d file when its in a location like "C:\New Folder" or whatever but cannot attach for paths starting with "C:\Documents and Settings\"..., i dont know if its a folder permission/restriction setting stuffs
    Nobody is smarter than all of us!

  5. #5

    Thread Starter
    Hyperactive Member oyad's Avatar
    Join Date
    Feb 2003
    Location
    PhoxWare MicroSystems
    Posts
    463

    Re: Problem Attaching SQL Server Database file

    Quote Originally Posted by Hack
    Well, a database is not a document so even if it could be in MyDocuments, it shouldn't be.

    May I ask why you want to put it there?
    it is contained in an application 4 a friend, he could place it any where
    Nobody is smarter than all of us!

  6. #6
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Problem Attaching SQL Server Database file

    http://blogs.msdn.com/sqlexpress/arc...nt-studio.aspx

    Additionally, the default service account used by SQL Express do not have permissions for any of directories in a user profile, such a My Documents, which is the default location for databases created by VS. In your case, either you have given the Network Service account permissions for your user profile directories, or you are running SQL Express under a different account that does have permissions for those directories. (Or |DataDirectory| is pointed to somewhere that is not in a user profile.)
    Seems you have a known issue with My Documents...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

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



Click Here to Expand Forum to Full Width