0

I need to relocate files to SQL Server 2000 default data folder programmatically using C#, I have searched a lot but couldn't find a solution.

Given below link only works for SQL Server 2005 and above versions. C# How to get SQL Server installation path programatically?

Please help me. Thanks in advance.

1 Answer 1

0

The "supported" way to do this would be to use DMO. The property you want is called SQLDataRoot:

The SQLDataRoot property identifies the default operating-system directory implementing storage for Microsoft SQL Server system user-defined databases.

The root of the DMO documentation is here

In fact, SMO (that was released with SQL Server 2005) supports connecting to SQL Server 2000, so you should use SMO for this task. The property you want there is, I believe, DefaultFile

This has the benefit that the same code should work against 2000,2005,2008 and 2008 R2 instances.

Sign up to request clarification or add additional context in comments.

1 Comment

the problem here is how am i supposed to relocate without path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.