views:

464

answers:

4

I am trying to use the aspnet___regsql utility to install all the membership tables in a database on my local SQL Express 2008 instance. I can connect without problems in Management Studio, but when I try to list the databases in the aspnet_regsql interface i get an error message saying:

Failed to query a list of database names from the SQL Server.
Invalid object name 'sysdatabases'

What am I doing wrong? How do I fix this?

(Please tell me there's a smoother way than reinstalling the thing... :P)

A: 

that table is only available in the master database

SQLMenace
I am not getting even that far - it is when I try to list the different databases that I get the error. Should I delete the table from the master db?
Tomas Lycken
No, NEVER EVER delete any tables in the master database. does this work from SSMS select * from master..sysdatabases? if so then the problem is with the aspnet_regsql
SQLMenace
yes, the query works from SSMS, so i guess the problem is with aspnet_regsql. what can i do to fix it? do i have to reinstall .net framework (sigh...) or is there a shortcut?
Tomas Lycken
+2  A: 

I have solved the problem by bypassing the graphic interface and performing the same action directly in the command prompt, with flags specifying all options. They should look like this:

Connect using SQL Authentication

C:\>Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -S myHostingServer -A all -d myDatabase -U myUserID -P myPassword

Connect using Windows Authentication

C:\>Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -S myHostingServer -A all -d myDatabase -E

The difference is at the end of the lines, where SQL Auth. has -U myUsername -P myPassword while Windows Auth. has -E (which flags for Trusted Connection).

Tomas Lycken
A: 

By default on Vista the current user on the machine is not a member of SysAdmin on SQL Server 2005/2008.

So here is the trick.

1-Open Sql Server Surface Area Configuration tool from C:\Program Files\Microsoft SQL Server 2005/2008.

2-When the screen pops up click on Add New Administrator.

    -on top right make sure that User to provision=Username of the pc
    -on your left (Available Privileges) select Member of SQL Server SysAdmin and click on the right arrow (>)
    -click ok and you should be ready to go.

My name is Talley Ouro,Developer in Raleigh,NC Blog: http://talleyblogs.blogspot.com/ Email:[email protected]

A: 

This issue is generally caused by leaving "Server" to be your machine name instead of the name of your SQL server instance. It's tricky to figure out because they autofill the text box to your machine name, which is needed but incomplete. This may lead you to think "Server" refers to the computer itself when they really mean SQL server instance. If you are connecting to your local machine you can generally append to their entry with the name of your SQL instance and everything will work as intended

IE LOCALHOST must become LOCALHOST\SQLEXPRESS or whatever you name your box\sqlserver

hqrsie

related questions