Thursday, March 29, 2012
Error when trying to create new SQL Server login via ado.Net
in VB.Net:
conn.open
sqlString="CREATE LOGIN test WITH PASSWORD = '1qaz2wsx'"
command=new SqlCommand(sqlString)
command.connection = conn
command.ExecuteNonQuery()
The error occurs when executing the ExecuteNonQuery line and is:
"Line1: Incorrect syntax near 'LOGIN' "
The database connection is connected to the master database of SQL 2005
Express using the sa account. This line executes just fine in Sql
Server Studio Manger when connected as sa. Am I not allowed to create
database logins via ado.net?!?! I need to for my application.
Thx,
MarcusHi
It seems to be something wrong with quoatations. Print the sqlString and see
if you can execute it in QA
"holysmokes99" <holysmokes99@.hotmail.com> wrote in message
news:1143588567.138045.218660@.j33g2000cwa.googlegroups.com...
>I get an error when I try to execute the following code using ADO.Net
> in VB.Net:
> conn.open
> sqlString="CREATE LOGIN test WITH PASSWORD = '1qaz2wsx'"
> command=new SqlCommand(sqlString)
> command.connection = conn
> command.ExecuteNonQuery()
> The error occurs when executing the ExecuteNonQuery line and is:
> "Line1: Incorrect syntax near 'LOGIN' "
> The database connection is connected to the master database of SQL 2005
> Express using the sa account. This line executes just fine in Sql
> Server Studio Manger when connected as sa. Am I not allowed to create
> database logins via ado.net?!?! I need to for my application.
> Thx,
> Marcus
>|||I suggest you double check your connection string to make sure you are
connected to the SQL Express instance since this message indicates you are
connected to a pre-SQL 2000 instance. You can insert code like the example
below to query the instance version. My SQL Express instance returns
"9.00.1399.06".
command=new SqlCommand("SELECT SERVERPROPERTY('ProductVersion')")
Dim version as String = command.ExecuteScalar().ToString()
MessageBox.Show(version)
Hope this helps.
Dan Guzman
SQL Server MVP
"holysmokes99" <holysmokes99@.hotmail.com> wrote in message
news:1143588567.138045.218660@.j33g2000cwa.googlegroups.com...
>I get an error when I try to execute the following code using ADO.Net
> in VB.Net:
> conn.open
> sqlString="CREATE LOGIN test WITH PASSWORD = '1qaz2wsx'"
> command=new SqlCommand(sqlString)
> command.connection = conn
> command.ExecuteNonQuery()
> The error occurs when executing the ExecuteNonQuery line and is:
> "Line1: Incorrect syntax near 'LOGIN' "
> The database connection is connected to the master database of SQL 2005
> Express using the sa account. This line executes just fine in Sql
> Server Studio Manger when connected as sa. Am I not allowed to create
> database logins via ado.net?!?! I need to for my application.
> Thx,
> Marcus
>|||> It seems to be something wrong with quoatations. Print the sqlString and
> see if you can execute it in QA
No need to print the SQL statement here since it is in clear text in Marcus'
code snippet:
CREATE LOGIN test WITH PASSWORD = '1qaz2wsx'
Hope this helps.
Dan Guzman
SQL Server MVP
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eVeLQavUGHA.4436@.TK2MSFTNGP10.phx.gbl...
> Hi
> It seems to be something wrong with quoatations. Print the sqlString and
> see if you can execute it in QA
>
> "holysmokes99" <holysmokes99@.hotmail.com> wrote in message
> news:1143588567.138045.218660@.j33g2000cwa.googlegroups.com...
>|||Hi,Dan
Yep, I got it. thanks
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:uahPs5yUGHA.5900@.tk2msftngp13.phx.gbl...
> No need to print the SQL statement here since it is in clear text in
> Marcus' code snippet:
> CREATE LOGIN test WITH PASSWORD = '1qaz2wsx'
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:eVeLQavUGHA.4436@.TK2MSFTNGP10.phx.gbl...
>|||Oh, Jeesh, My bad!!! Dan you were spot on. I was connecting to an
instance of SQL Server 2000, and not Express. I have both on my machine
and forgot to reference it as "Marcus\SQLEXPRESS", instead using
"Marcus" only. CREATE LOGIN is new for SQL Server 2005 and thus I got a
syntax error when connecting to SQL 2000. Thanks for your insight.
On a sort-of-related note, is there a way for me to iterate through all
the SQL Server Express instances on the network? Using SQL-DMO, the
code below gives me the names of the servers, but some of the SQL
Express servers are named "[server_name]\SQLEXPRESS", while others are
just "[server_name]" (even though they do not have anything other that
SQL Express on them). If they were all suffixed with "SQLEXPRESS" then
that would be easy, but it doesn't seem to work that way.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim oNames As SQLDMO.NameList
Dim oSQLApp As SQLDMO.Application
Dim oServer As SQLDMO.SQLServer2
oSQLApp = New SQLDMO.Application
oNames = oSQLApp.ListAvailableSQLServers
For i As Integer = 1 To oNames.Count
TextBox1.AppendText(oNames.Item(i) + Environment.NewLine)
Next
End sub
Thanks!
Marcus|||Check the following:
1) SQL Brower service is enabled and running
2) Port 1434 isn't blocked (e.g. Windows firewall)
3) The SQL Express instance is configured for remote connections
Hope this helps.
Dan Guzman
SQL Server MVP
"Marcus" <holysmokes99@.hotmail.com> wrote in message
news:1143659183.191249.143360@.e56g2000cwe.googlegroups.com...
> Oh, Jeesh, My bad!!! Dan you were spot on. I was connecting to an
> instance of SQL Server 2000, and not Express. I have both on my machine
> and forgot to reference it as "Marcus\SQLEXPRESS", instead using
> "Marcus" only. CREATE LOGIN is new for SQL Server 2005 and thus I got a
> syntax error when connecting to SQL 2000. Thanks for your insight.
> On a sort-of-related note, is there a way for me to iterate through all
> the SQL Server Express instances on the network? Using SQL-DMO, the
> code below gives me the names of the servers, but some of the SQL
> Express servers are named "[server_name]\SQLEXPRESS", while others are
> just "[server_name]" (even though they do not have anything other that
> SQL Express on them). If they were all suffixed with "SQLEXPRESS" then
> that would be easy, but it doesn't seem to work that way.
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button2.Click
> Dim oNames As SQLDMO.NameList
> Dim oSQLApp As SQLDMO.Application
> Dim oServer As SQLDMO.SQLServer2
> oSQLApp = New SQLDMO.Application
> oNames = oSQLApp.ListAvailableSQLServers
> For i As Integer = 1 To oNames.Count
> TextBox1.AppendText(oNames.Item(i) + Environment.NewLine)
> Next
> End sub
>
> Thanks!
> Marcus
>|||Thanks, Dan. You were right again. On the machine with SQL Express
only, Windows Firewall was on. When I disabled it, the server name and
sql server instancen name came up when I ran the code above, i.e.
"training\sqlexpress", not just the server name as before when firewall
was active. Why did the server name come up at all then when the
firewall was enabled, when using the SQL-DMO code above?
Cheers,
Marcus|||> Why did the server name come up at all then when the
> firewall was enabled, when using the SQL-DMO code above?
IIRC, before SQL Server 2000, network broadcast packets sent to facilitate
server enumeration. According to Perter's blog
(http://blogs.msdn.com/sql_protocols.../24/473502.aspx), legacy
behavior can show default instances even with UDP 1434 blocked.
Hope this helps.
Dan Guzman
SQL Server MVP
"Marcus" <holysmokes99@.hotmail.com> wrote in message
news:1143736505.471840.78380@.i39g2000cwa.googlegroups.com...
> Thanks, Dan. You were right again. On the machine with SQL Express
> only, Windows Firewall was on. When I disabled it, the server name and
> sql server instancen name came up when I ran the code above, i.e.
> "training\sqlexpress", not just the server name as before when firewall
> was active. Why did the server name come up at all then when the
> firewall was enabled, when using the SQL-DMO code above?
> Cheers,
> Marcus
>sql
Wednesday, March 21, 2012
Error when exporting to PDF
I am having an issue exporting reports to PDF.
I am connecting to the report server via https and all of the reports I'm using are working fine, but when I try and export the reports to PDF I run into problems.
On one machine running XP when I try and export a report to PDF; it will let me open the PDF, but if I try and 'save' the PDF it gives me an error that the site cannot be found.
On another machine running Windows 2000, I cannot save or open the report when trying to export to PDF with the same site cannot be found popup from Internet Explorer.
Anyone know of anything special that I need to setup to get this working? Could this be a mime type issue on the server?
Any help is greatly appreciated!
Just to add to this..
I am able to export to PDF and open on a machine running Acrobat reader 5.0,and a machine running Acrobat reader 6.0 but not from any computer running Acrobat reader 7.0!
Any ideas?
Monday, March 19, 2012
Error when connecting to SQL Server
Hi
when i tried connecting to SQL Server Express I got this error, be it connecting via Windows Authentication or SQL Authentication. Pls see below for the error message:
===================================
Cannot connect to JOHNSON\SQLEXPRESS.
===================================
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (.Net SqlClient Data Provider)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
Error Number: -1
Severity: 20
State: 0
Program Location:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
wats wrong with my setup? Previously it can connect. till i upgraded to SQL Server 2005 then uninstall my SQL Server 2005 then it become like tt....
what shld i do?
Pls advise.
Thanks
Johnson
Did you enable remote connections ? This is disabled by default. See the Screencast on my site for more information.Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||
Hi,
THanks for the reply but when i look into ur screencast and followed the steps to enable remote connection, I got the below error when try to click on the Surface Area Configureation.
"===================================
No SQL Server 2005 components were found on the specified computer. Either no components are installed, or you are not an administrator on this computer. (SQLSAC)
Program Location:
at Microsoft.SqlSac.MainPanel.FormServicesAndProtocols.ProcessClassConstructor()"
By the way y do i nd to enable remote connection when i am trying to connect to only my local SQLExpress?
I am using SQL Express and not SQL Server 2005.
Thanks
Johnson
|||Are you trying to configure the local computer ?|||ya i m trying to access my SQL Mobile database using my SQL Server Management Studio Express. But when i tried connecting using SQL Server Management Studio Express to my local machine, I got thrown the error.
As mentioned I previously upgraded my SQL Server Express to SQL Server 2005. Thereafter I uninstall my SQL Server 2005 and reinstall ym VS 2005. So i duno is it cos of this. If so, wat shld I do to resolve this?
Can u advise wat's wrong?
Thanks
Johnson
|||Hi Johnson,
I'm trying to understand what you're really trying to do here because your information is conflicting, maybe you can clarify a bit...
Are you trying to work with SQL Mobile or SQL Express? They are two different products. Do you have SQL Express installed or not? You've claimed that you installed it, then uninstalled it. You can't connect to it if you've uninstalled it. Do you have an entry on your Start menu for Microsoft SQL Server 2005? What is on it?|||SQL Network Interfaces, error: 26 - Error Locating Server/Instance SpecifiedSQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified
This usually means the application cannot contact your SQL Browser. So, make sure SQL Browser is running and it's firewalled(put sqlbrowser.exe or UDP 1434 into exception).
|||Hi Thanks..
I resolve the problem already. cos there isnt any SQL Server instance installed
Thanks
Johnson
Error when connecting to server via SQL 2005 Management Studio in Object Explorer but not Query
Hi,
I'm getting the error below when I attempt to connect to a remote Sql 2005 server using Management Studio and the Object Explorer. The same error does not occur if I go through "New > Database Engine Query" and fill out the same connection dialog with the exact same information. FYI, I am connecting to the IP of an external SQL 2005 server via SQL Server Authentication, and there is some level of connection going on as connecting with the wrong authentication information gives me a standard authentication error even while using the Object Explorer dialog. I am able to do all operations I need in the database engine query window without problem.
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=64&LinkId=20476
Any ideas on why this would occur? I know this is a standard "network issue" type problem but I'm not aware of any difference that would allow the connection to work fine in one and not the other.
Thanks!
I have this exact error too. Please post if you have made progress on this.
-H
|||Same error here as well. I can connect using 2005 management studio from my XP workstation, but my Vista machine throws this error.|||OK - Same error - also from a Vista machine. Has anyone found the solution|||I think there is some problem with the object explorer dlls. I got the error after installing MDAC 2.7. When i connect it says some dll does registered, but i can connect thru database engine query.|||This shouldn't be related to MDAC at all. Management Studio doesn't use MDAC for any connections. How are you establishing your connections (using server name or IP)?|||I suspect you are running into a firewall issue on Vista. The built-in firewall on Vista is much more capable than the XP firewall. The Vista firewall can block outbound connections as well as the inbound connections the XP firewall can block.
Make sure you add a firewall exception for sqlwb.exe (the management studio executable). You might need to open up port 1433 TCP as well.
Hope this helps,
Steve
Error when connecting to server via SQL 2005 Management Studio in Object Explorer but not Query
Hi,
I'm getting the error below when I attempt to connect to a remote Sql 2005 server using Management Studio and the Object Explorer. The same error does not occur if I go through "New > Database Engine Query" and fill out the same connection dialog with the exact same information. FYI, I am connecting to the IP of an external SQL 2005 server via SQL Server Authentication, and there is some level of connection going on as connecting with the wrong authentication information gives me a standard authentication error even while using the Object Explorer dialog. I am able to do all operations I need in the database engine query window without problem.
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=64&LinkId=20476
Any ideas on why this would occur? I know this is a standard "network issue" type problem but I'm not aware of any difference that would allow the connection to work fine in one and not the other.
Thanks!
I have this exact error too. Please post if you have made progress on this.
-H
|||Same error here as well. I can connect using 2005 management studio from my XP workstation, but my Vista machine throws this error.|||OK - Same error - also from a Vista machine. Has anyone found the solution|||I think there is some problem with the object explorer dlls. I got the error after installing MDAC 2.7. When i connect it says some dll does registered, but i can connect thru database engine query.|||This shouldn't be related to MDAC at all. Management Studio doesn't use MDAC for any connections. How are you establishing your connections (using server name or IP)?|||I suspect you are running into a firewall issue on Vista. The built-in firewall on Vista is much more capable than the XP firewall. The Vista firewall can block outbound connections as well as the inbound connections the XP firewall can block.
Make sure you add a firewall exception for sqlwb.exe (the management studio executable). You might need to open up port 1433 TCP as well.
Hope this helps,
Steve
Monday, March 12, 2012
Error when connecting to server via SQL 2005 Management Studio in Object Explorer but not Query
Hi,
I'm getting the error below when I attempt to connect to a remote Sql 2005 server using Management Studio and the Object Explorer. The same error does not occur if I go through "New > Database Engine Query" and fill out the same connection dialog with the exact same information. FYI, I am connecting to the IP of an external SQL 2005 server via SQL Server Authentication, and there is some level of connection going on as connecting with the wrong authentication information gives me a standard authentication error even while using the Object Explorer dialog. I am able to do all operations I need in the database engine query window without problem.
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=64&LinkId=20476
Any ideas on why this would occur? I know this is a standard "network issue" type problem but I'm not aware of any difference that would allow the connection to work fine in one and not the other.
Thanks!
I have this exact error too. Please post if you have made progress on this.
-H
|||Same error here as well. I can connect using 2005 management studio from my XP workstation, but my Vista machine throws this error.|||OK - Same error - also from a Vista machine. Has anyone found the solution|||I think there is some problem with the object explorer dlls. I got the error after installing MDAC 2.7. When i connect it says some dll does registered, but i can connect thru database engine query.|||This shouldn't be related to MDAC at all. Management Studio doesn't use MDAC for any connections. How are you establishing your connections (using server name or IP)?|||I suspect you are running into a firewall issue on Vista. The built-in firewall on Vista is much more capable than the XP firewall. The Vista firewall can block outbound connections as well as the inbound connections the XP firewall can block.
Make sure you add a firewall exception for sqlwb.exe (the management studio executable). You might need to open up port 1433 TCP as well.
Hope this helps,
Steve
Error when connecting to server via SQL 2005 Management Studio in Object Explorer but not Query
Hi,
I'm getting the error below when I attempt to connect to a remote Sql 2005 server using Management Studio and the Object Explorer. The same error does not occur if I go through "New > Database Engine Query" and fill out the same connection dialog with the exact same information. FYI, I am connecting to the IP of an external SQL 2005 server via SQL Server Authentication, and there is some level of connection going on as connecting with the wrong authentication information gives me a standard authentication error even while using the Object Explorer dialog. I am able to do all operations I need in the database engine query window without problem.
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=64&LinkId=20476
Any ideas on why this would occur? I know this is a standard "network issue" type problem but I'm not aware of any difference that would allow the connection to work fine in one and not the other.
Thanks!
I have this exact error too. Please post if you have made progress on this.
-H
|||Same error here as well. I can connect using 2005 management studio from my XP workstation, but my Vista machine throws this error.|||OK - Same error - also from a Vista machine. Has anyone found the solution|||I think there is some problem with the object explorer dlls. I got the error after installing MDAC 2.7. When i connect it says some dll does registered, but i can connect thru database engine query.|||This shouldn't be related to MDAC at all. Management Studio doesn't use MDAC for any connections. How are you establishing your connections (using server name or IP)?|||I suspect you are running into a firewall issue on Vista. The built-in firewall on Vista is much more capable than the XP firewall. The Vista firewall can block outbound connections as well as the inbound connections the XP firewall can block.
Make sure you add a firewall exception for sqlwb.exe (the management studio executable). You might need to open up port 1433 TCP as well.
Hope this helps,
Steve
Error when connecting to server via SQL 2005 Management Studio in Object Explorer but not Qu
Hi,
I'm getting the error below when I attempt to connect to a remote Sql 2005 server using Management Studio and the Object Explorer. The same error does not occur if I go through "New > Database Engine Query" and fill out the same connection dialog with the exact same information. FYI, I am connecting to the IP of an external SQL 2005 server via SQL Server Authentication, and there is some level of connection going on as connecting with the wrong authentication information gives me a standard authentication error even while using the Object Explorer dialog. I am able to do all operations I need in the database engine query window without problem.
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=64&LinkId=20476
Any ideas on why this would occur? I know this is a standard "network issue" type problem but I'm not aware of any difference that would allow the connection to work fine in one and not the other.
Thanks!
I have this exact error too. Please post if you have made progress on this.
-H
|||Same error here as well. I can connect using 2005 management studio from my XP workstation, but my Vista machine throws this error.|||OK - Same error - also from a Vista machine. Has anyone found the solution|||I think there is some problem with the object explorer dlls. I got the error after installing MDAC 2.7. When i connect it says some dll does registered, but i can connect thru database engine query.|||This shouldn't be related to MDAC at all. Management Studio doesn't use MDAC for any connections. How are you establishing your connections (using server name or IP)?|||I suspect you are running into a firewall issue on Vista. The built-in firewall on Vista is much more capable than the XP firewall. The Vista firewall can block outbound connections as well as the inbound connections the XP firewall can block.
Make sure you add a firewall exception for sqlwb.exe (the management studio executable). You might need to open up port 1433 TCP as well.
Hope this helps,
Steve
Error when changing sa password or when trying to access DB via sa
Two weird things with the sa account, and I found a solution on
Microsoft.com, but it's not working.
First, when I go to change the SA password in Enterprise Manager, I
get the following error:
Error 21776: [SQL-DMO] The name 'dbo' was not found in the Users
collection. If the name is a qualified name, use [] to separate
various parts of the name, and try again.
So, I checked the knowledgebase and found this:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q218/1/72.ASP&NoWebContent=1#appliesto
This is the exact issue I'm having, but when I run: sp_changedbowner
sa
... I get the following message in Query Analyzer:
Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
22
Cannot change the owner of the master database.
So, I searched for this error and found this:
http://support.microsoft.com/default.aspx?scid=kb;en-us;328173
Catch-22... I need to change the Master DB to be owned by 'sa', yet it
won't let me change it since it's not already owned. Am I missing
something? This did happen just after I restored a database, just as
discribed in the first support doc, but it gives no exact syntax on
what to plug into Query Analyzer to resolve the issue, other then
using the sp_changedbowner stored procedure. And I must be using it
incorrectly to get the error, or it's another bug in MS SQL.
Can someone point me to the right direction? What should be an easy
back-up and restore is turning into a multi-hour ordeal.
Thanks,
Alex.If your a local admin or domain admin connect to the SQL Server using Query
Analyser and ask for a 'WinNT Authentication' then issue the following
command
A. Change the password of a login without a former password
This example changes the password for the login Victoria from a NULL
password to "B3r12-36".
EXEC sp_password NULL, 'B3r12-36', 'Victoria'
In EnterPrise manager Delete and Re-Register the troublesome server, when
registering use the new password.
--
HTH
Ryan Waight, MCDBA, MCSE
"Alex" <alex@.totallynerd.com> wrote in message
news:2ba4b4eb.0310270835.36d6e245@.posting.google.com...
> Hi,
> Two weird things with the sa account, and I found a solution on
> Microsoft.com, but it's not working.
> First, when I go to change the SA password in Enterprise Manager, I
> get the following error:
> Error 21776: [SQL-DMO] The name 'dbo' was not found in the Users
> collection. If the name is a qualified name, use [] to separate
> various parts of the name, and try again.
> So, I checked the knowledgebase and found this:
>
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q218/1/72.ASP&NoWebContent=1#appliesto
> This is the exact issue I'm having, but when I run: sp_changedbowner
> sa
> ... I get the following message in Query Analyzer:
> Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
> 22
> Cannot change the owner of the master database.
> So, I searched for this error and found this:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;328173
> Catch-22... I need to change the Master DB to be owned by 'sa', yet it
> won't let me change it since it's not already owned. Am I missing
> something? This did happen just after I restored a database, just as
> discribed in the first support doc, but it gives no exact syntax on
> what to plug into Query Analyzer to resolve the issue, other then
> using the sp_changedbowner stored procedure. And I must be using it
> incorrectly to get the error, or it's another bug in MS SQL.
> Can someone point me to the right direction? What should be an easy
> back-up and restore is turning into a multi-hour ordeal.
> Thanks,
> Alex.|||Yes, you cannot change database owner to MASTER.
If you run sp_helpuser on your restored database, should
show the "LoginName" as NULL if 'sa' do not own it.
You only needed to run sp_changedbowner on your restored
database. -->
use <restored_db>
go
sp_changedbowner 'sa'
go
Friday, March 9, 2012
Error when attempting to backup to a second disk file
In SQL Server 2005, via the GUI, I wish to backup a database to an additional disk file (there is already an existing backup disk file for this database), so that I can have more than one backup. I've added the new disk file name, highlighted it, and clicked OK.
I get an immediate error (see below). Note, the 2nd error message is specifying the existing backup disk file, not the new one I'm attempting to create.
"Backup failed for Server 'WCS-DEV-TPA'. (Microsoft.SqlServer.Smo)"
"System.Data.SqlClient.SqlError: The volume on device 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\WCS_ADV_Longmont.bak' is not part of a multiple family media set. BACKUP WITH FORMAT can be used to form a new media set. (Microsoft.SqlServer.Smo)"
Does anyone know what causes this and how to correct it?
Try removing all but the new disk file name. Also you can just copy the first backup(s) to another drive.|||While that would be a good workaround, it won't meet my needs.
(a) The users will need to make multiple backups and retain several older versions in order to be able to restore a specific version if necessary. (b) The users who will be making the backups will not have access to the file system on the computer that will host the backup disk files.
Is there a way to correct this problem so that we can have multiple disk backups via the GUI? (The users in question won't be knowledgeable (or privileged) enough to create SQL scripts to do the backups on this 'ad-hoc' basis.)
|||From another post:
You can use the UI to create a Maintenance Plan(s) with multiple backups. If these are adhoc backups they'll have to be separately.
Kevin Farlee
Posts 224
Was this post helpful ?
When you back up to two files, you are creating a stripe set. The restriction is that all backups sent to a media set must have the same number of stripes. That's the meaning of your error.
You need to create a media set with the number of stripes you want to use. You can't add members later.
The method for creating a new media set is to use the WITH FORMAT option on your backup command. This is the equivalent of reformatting a tape for backups. It wipes out any previous data in the file(s), and sets up the headers correctly.
So, if you issue the same command in your script, adding WITH FORMAT for ONE TIME ONLY, the first time you use that media family, you should be good to go. From then on, you can just use it as your script is now.
Microsoft SQL Server Storage Engine PM
[1] This is for use in ad-hoc backups and need to be done by fairly inexperienced users as desired before running application software that will modify the database.
[2] We don't want to backup the database to a multiple disk file set - we want to be able to specify a new disk file to receive the database backup, giving us the capability of seeing multiple versions of the database (based on the backup snapshot in each disk file) and restoring (if necessary) from any one of the backup disk files. Doing this through the GUI is necessary because of this will be done with less privileged and knowledgeable users.
|||Sorry I can't be of more help.
The only solution I can see is for your users to use the UI to back up to only one "location" at a time. They will just have to use the UI to twice, each time backing up to one location.
|||Does this mean that the problem I'm reporting is a known flaw (bug?) in the SQL Server management GUI? It can't be corrected to allow the specification of several backup disk files?|||I would just say that the Backup Database dialog only allows for one backup at a time to either a single file or device or a multiple family media set. It has to be used two times for two backups.
You can use the Maintenance Plan UI to create a plan with two backup tasks, to two different folders, that run in series and you can schedule that plan.
The UI for the Maintenance Plan - Backup Database Task is similiar to the Backup Database dialog.:
|||
OK, I see. It looks like we'll have to re-evaluate how the permissions will be allocated to users in consideration of this. Thank you (all of y'all) for your help.
Regards,
Douglas
|||Help me understand more about what you're trying to accomplish:
Are you trying to get two files, each containing exactly the same backup content?
or are you wanting to have a collection of backups of the same database at different times?
If you want the former, you want to use the MIRROR TO clause in the Backup command. I can't find a button on the GUI for it, but if you set up a backup, and specify two files, then click on the "script" button, you'll get a backup command with two disk files separated by a comma. i.e.
BACKUP DATABASE foo TO DISK = N'C:\somefile.bak', DISK = N'D:\AnotherFile.BAK' WITH FORMAT;
if you replace the comma with 'MIRROR TO', as in
BACKUP DATABASE foo TO DISK = N'C:\somefile.bak' MIRROR TO DISK = N'AnotherFile.BAK' WITH FORMAT;
then hit "GO" you'll get two copies of a backup of database foo instead of a stripe set.
|||We're wanting to "have a collection of backups of the same database at different times".
Sunday, February 26, 2012
Error Update
I create the View which consist of multiple same table. When I want to update via the View, it doesn't allow me to update it, it gave out the following message,
View or function 'Table1' is not updatable because the modification affects multiple base tables.What do you mean by "multiple same table"? If you're saying the view has self-joins, then the view is not going to be updatable.
Friday, February 24, 2012
Error Trying to Import MS Access 2003 database via SQL Server Import and Export Wizard - Too man
I am trying to simplify a query given to me by one of my collegues written using the query designer of Access. Looking at the query there seem to be some syntax differences, so to see if this was the case I thought I would import the database to my SQL Server Developer edition.
I tried to start the wizard from within SQL Server Management Studio Express as shown in one of the articles on MSDN which did not work, but the manual method also suggested did work.
Trouble is that it gets most of the way through the import until it spews forth the following error messages:
- Prepare for Execute (Error)
Messages
Error 0xc0202009: {332B4EB1-AF51-4FFF-A3C9-3AEE594FCB11}: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Could not start session. Too many sessions already active.".
(SQL Server Import and Export Wizard)
Error 0xc020801c: Data Flow Task: The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.
(SQL Server Import and Export Wizard)
Error 0xc004701a: Data Flow Task: component "Source 33 - ATable" (2065) failed the pre-execute phase and returned error code 0xC020801C.
(SQL Server Import and Export Wizard).
There does not seem to be any method of specifying a number of sessions, so I don't see how to get round the problem.
Does anyone know how I can get the import to work?
try clicking the "optimize for many tables" checkbox on the wizard screen where you select the tables to move. that will move the tables one at a time instead of trying to do them all in parallel.|||Even after I tick the checkbox in the grey header control that selects all the tables in the database, the "optimize for many tables" checkbox on the wizard screen is greyed out.Error Trying to Import MS Access 2003 database via SQL Server Import and Export Wizard - Too
I am trying to simplify a query given to me by one of my collegues written using the query designer of Access. Looking at the query there seem to be some syntax differences, so to see if this was the case I thought I would import the database to my SQL Server Developer edition.
I tried to start the wizard from within SQL Server Management Studio Express as shown in one of the articles on MSDN which did not work, but the manual method also suggested did work.
Trouble is that it gets most of the way through the import until it spews forth the following error messages:
- Prepare for Execute (Error)
Messages
Error 0xc0202009: {332B4EB1-AF51-4FFF-A3C9-3AEE594FCB11}: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Could not start session. Too many sessions already active.".
(SQL Server Import and Export Wizard)
Error 0xc020801c: Data Flow Task: The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.
(SQL Server Import and Export Wizard)
Error 0xc004701a: Data Flow Task: component "Source 33 - ATable" (2065) failed the pre-execute phase and returned error code 0xC020801C.
(SQL Server Import and Export Wizard).
There does not seem to be any method of specifying a number of sessions, so I don't see how to get round the problem.
Does anyone know how I can get the import to work?
try clicking the "optimize for many tables" checkbox on the wizard screen where you select the tables to move. that will move the tables one at a time instead of trying to do them all in parallel.|||Even after I tick the checkbox in the grey header control that selects all the tables in the database, the "optimize for many tables" checkbox on the wizard screen is greyed out.