Search This Blog

Loading...
Showing posts with label MS SQL 2008 Express. Show all posts
Showing posts with label MS SQL 2008 Express. Show all posts

Saturday, November 1, 2014

SQL Server 2008 is not a valid login or you do not have permission

Facing issue when try to install Microsoft SQL Server 2008 R2 in Windows 7.

TITLE: Microsoft SQL Server 2008 R2 Setup ------------------------------ The following error has occurred: '' is not a valid login or you do not have permission. For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&

Solution:

Most of the people will face this error if the computer name and the user name is the same. Once change one of these, problem will be solved.

Saturday, February 22, 2014

How to determine MSSQL version and edition?

How to determine MS SQL version and edition?


  1. Go to Open Query Analyzer 
  2. Paste sql script below

    SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
  3. Click on Execute button




There you can see the version and edition for Microsoft SQL server installed in your computer.

Thursday, August 8, 2013

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created

Facing issue when try to change the table structure in MSSQL 2012

Error Message

"Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created"

To solve this issue,


In Management Studio, click menu Tools -> Options -> Designers-> Uncheck "Prevent saving changes that require table re-creation



Go to change the table structure again, now it's work.

Hope this helps.

Wednesday, January 16, 2013

Enable TCP/IP Protocol and set Login mode to Mixed mode in C#

Try to enable Microsoft SQL Server 2008 TCP/IP Protocol and set the Login mode to Mixed mode using C# without involve registry. Come across information below http://stackoverflow.com/questions/2266697/changing-sql-server-settings-programmatically

The information is really helpful but when try it in SQL Server 2008 using the C# source code given, it's not working very well. Then try to do some testing and finally it's work. I've added a line srv.Settings.Alter();



private static bool SetServerProperties()
    {
        #region standardize Connection String
        string tempCatalog = "master";
        string temp = @"Data Source=" + dataSource + ";Initial Catalog=" + tempCatalog + ";Integrated Security=True;MultipleActiveResultSets=True";
        #endregion

        SqlConnection sqlconnection = new SqlConnection(temp);
        SqlCommand cmd = new SqlCommand("select @@ServerName", sqlconnection);
        sqlconnection.Open();
        string serverName = "";
        try
        {
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
                serverName = dr[0].ToString();
        }
        catch
        {
            MessageBox.Show("Failed to Set SQL Server Properties for remote connections.");
        }

        Server srv = new Server(serverName);
        srv.ConnectionContext.Connect();
        srv.Settings.LoginMode = ServerLoginMode.Mixed;
srv.Settings.Alter(); 

        ManagedComputer mc = new ManagedComputer();

        try
        {
            Service Mysvc = mc.Services["MSSQL$" + serverName.Split('\\')[1]];

            if (Mysvc.ServiceState == ServiceState.Running)
            {
                Mysvc.Stop();
                Mysvc.Alter();

                while (!(string.Format("{0}", Mysvc.ServiceState) == "Stopped"))
                {
                    Mysvc.Refresh();
                }
            }

            ServerProtocol srvprcl = mc.ServerInstances[0].ServerProtocols[2];
            srvprcl.IsEnabled = true;
            srvprcl.Alter();


            Mysvc.Start();
            Mysvc.Alter();

            while (!(string.Format("{0}", Mysvc.ServiceState) == "Running"))
            {
                Mysvc.Refresh();
            }
            return true;
        }
        catch
        {
            MessageBox.Show("TCP/IP connectin could not be enabled.");
            return false;
        }
    }


Thanks to http://stackoverflow.com/users/1635051/reza-ameri

Monday, February 9, 2009

Installation SQL 2008 Express Error: '' is not a valid login or you do not have permission

This is a very strange error. I've received error message "'' is not a valid login or you do not have permission" when trying to install Microsoft SQL Server 2008 Express Edition in my Microsoft XP Pro SP3 Machine.

To know more on installation guide, please check Install and Configure SQL Server 2008 Express by CondorMan.

I've followed the steps and got error message "'' is not a valid login or you do not have permission." and print screen as below.



I have no idea why is this. I've tried few suggestion stated in some of the forum:


  1. I've tried to change my user name and try to install.
  2. Create a new user "sa" with strong password. Login to window using this account and do installation.
Both methods fail.

Finally, i try to rename my machine/computer name and try to install and the installation completed successfully.




Conclusion:
This may be a bug from microsoft but i'm not sure.

My scenario: computer name = my user account

My Solution: change computer name to != user account then do installation.

p/s: Change user account won't help.

Hope this can help you. Share your solution if you have different one.