Sunday, July 17, 2011

Using xp_cmdshell for backup xcopy gives "Invalid drive specification"

PROBLEM:
When I do this, I get an error back that says "Invalid drive specification" so I verified that both UNC Paths were correct by copying and pasting each one into a Run window and each opened up the correct directory.
I typed out the xcopy command in a command prompt on my machine without ANY changes and the command executed fine.

SOLUTION:
SQL is executing the command shell under the account that the SQL service was started under. The SQL server service is running under a local account, not a domain account. Thus it can't see the domain thus it can't find the path you’re looking for. Check what account the service is running under.


If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!


Thursday, July 7, 2011

Incorrect syntax near “GO”

PROBLEM:
SQL Execution resulted in following Exceptions: System.Data.SqlClient.SqlException: Incorrect syntax near 'GO'. at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

SOLUTION:
1. Put the “GO” command on a new line, separate from the other statement
2. .SqlDataProvider file wasn't encoded in UTF-8 properly. Do save-as, then save file type with encoding UTF-8
3. Check issues with '+' and '-' signs in CREATE PROCEDURE scripts
4. Put an EOF char after the last “GO”


If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!


Wednesday, July 6, 2011

Shrink my database?

PROBLEM:
Why do I need to shrink my database?

SOLUTION:
Consider the following information when you plan to shrink a database:
  1. A shrink operation is most effective after an operation that creates lots of unused space, such as a truncate table or a drop table operation. 
  2. Most databases require some free space to be available for regular day-to-day operations. If you shrink a database repeatedly and notice that the database size grows again, this indicates that the space that was shrunk is required for regular operations. In these cases, repeatedly shrinking the database is a wasted operation. 
  3. A shrink operation does not preserve the fragmentation state of indexes in the database, and generally increases fragmentation to a degree. This is another reason not to repeatedly shrink the database. 
  4. Unless you have a specific requirement, do not set the AUTO_SHRINK database option to ON.
If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!

Team Foundation services are not available. Fatal error while initializing web service

PROBLEM:
You get the following errors using Visual Studio Team Explorer when trying to connect TFS
  • TF31001: Team Foundation cannot retrieve the list of team projects from Team Foundation Server servername. The Team Foundation Server returned the following error: Team Foundation services are not available from the server. 
  • TF30059: Fatal error while initializing web service. 

SOLUTION:
Check if your TFS database and IIS services are OK (up and running..)

If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!