.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Create table in the database using management studio

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net

 I have database already on the server. However, when I created new table, the new created table Schema is not dbo. it is my user name. How to solve this?

It shows the new created table Schema is my username but not dbo.

Even though I rename it, it couldn't change. I can see this in table property.



View Complete Post

More Related Resource Links

Cannot Create Database Diagrams - SQL Server 2008 Management Studio

I cannot create a database diagram with my client-side SQL Server Management Studio.  I can do this if I am on the actual db server itself.  Please help.

Failed to create new database in SQL Server Management Studio Express



I don't know why I can't create a new database in SQL Server Management Studio Express.



This is the reason:


CREATE DATABASE permission denied in database 'master'. (.Net SqlClient Data Provider)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=262&LinkId=20476

Server Name: Ning-PC\SQLEXPRESS
Error Number: 262
Severity: 14
State: 1
Line Number: 1

Program Location:

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndW

Create/add table from code to database



I create table:

                  DataSet data=new DataSet();

                  DataTable myTable = new DataTable("NewTable");

                   DataColumn[] keys = new DataColumn[1];

                   // create column
                   keys[0] = new DataColumn();
                   keys[0].DataType = System.Type.GetType("System.String");
                   keys[0].ColumnName = "PointID";
                   myTable.Columns.Add(keys[0]);    &nb

How to create a view in my database from a table in another server/database

Is there a way to create a view in my database referencing a table in another server/database if I have the connection information.  I know how to do it in Oracle, simply create a database link, but have never done so in sqlserver.

SQL Server Management Studio is not attaching a database.

Hi folks,I'm a newbie in development, and i'm facing a grave concern here.  Sql Server Management Studio (2008) does not seem to be able to attach  a database that i've already created in Sql Server 2005 express within my ASP.NET application.  When I try to attach the database, by clicking "Attach" after right clicking the Database note in object explorer, I get to see a dialog box with an Add button.  I then click that button, and try to navigate to the database, and I'm simply not able to reach that folder!!! The folder containing the databse physically exists, but i can't see it when i'm trying to browse to it.This is a Windows 7 (home edition) laptop, with VS 2008.Can someone please help me here???Thanks!

Hide system database in SQL Management Studio

I am using SQL server 2008 . What i all want is to create a uses that can only see the ABCDatabase in Management studio onced login. And to achieve that:1- I have created a new user.2- Deny View all database right to that user.3-Set that user as Owner of ABCDatabaseNow on login that user cannot see other databases but still able to see the system databases. How can i hide those system databases from that user?

How to create rule in SQL Server Management Studio Express?

How to create rule with SQL Server Management Studio Express? In SQL 2000 enterprise manager, when right-click the rules, I see "new rule". But in SQL 2005, when I right click into "rules" in the Programmability with database name, I no see "create rules" in context menu? My ask is: How to create rule with SQL Server Management Studio Express? SQL Server in My Computer is 2005 Express.

SQL Server Management Studio cannot locate my database

I had to uninstall SQL Server 08 when I left my last project, I have reinstalled the management studio but it no longer recognizes the databases that are on my local machine.  How can I reconcile the connection to the preexisting databases?  When I choose connect, nothing comes up in the options and when i type in the database name it errors out.  I thought it was just that the old files were corrupt but I installed a brand new database and while i can verify that it exists on my machine, I cannot connect through Management Studio.

Problem trying to attach database file to Microsoft SQL Server Management Studio

I was trying to attach a database to SQL Server MGT Studio and got an exception error.  The message stated that the database file I was trying to attach could not be opened because it was version 661.  The SQL Server shows to support version 655 and earlier.  It states that a downgrade path is not supported. Question:  Is there some download ; fix; I can make to SQL Server 2008 that will allow me to attach the version 661????  I am not technical at all.  Please speak slowly.  :)  Thanks

C# Database created but does not show up in Server Management Studio unless I manually attach it.


I used C# Linq to Sql to create a database. I look on the hard drive and the database .mdf and .ldf files are there. I open Server Management Studio 2008, attach to SQL express and the database is not there unless I actually attach the database.


First, is this correct behavior?

Second, is it possible to create a Sql Express database that is automatically registered(?) in Management Studio? If so, please give pointer.


Thanks very much.



how to connect my hosting database from my pc using sql server management studio 2005



I have one asp.net hosting account with some service provider.. 

They have given me some xxx.xxxxxx.com to access sql server from my desktop... 

I enter xxx.xxxxx.com in server name and username and password but it will not connect.. 

so please let me know what are the steps i have to do to access my hosting database...

they have given sql server 2008 im using in local sql server 2005 management studio so let me know how to connect

thanks in advance

Microsoft SQL Server Management Studio 2008 does not list all tables in database

When logging into SSMS 2008 to a SQL2008 database when I expand the tables in a database I only see a few tables listed.  I can login to the same instance with SSMS 2005 and all of the tables are there.  Is there a reason why this is this way?

I can do a select * from in a query window for any of the tables in the database via SSMS 2008 as well and it work fine.  It just does not display the tables.

Unable to create table dynamically in database


I am able to create database through script generated by SQL Server 2008 but unable to create tables from generated script. Please indicate if any step is missing.


************* Code *******************

 public bool CreateAppTables(string DatabaseName, string ConnectionString)
        string DatabaseScript;
        DatabaseScript = Activity.readTextFile(HttpContext.Current.Server.MapPath(".") + "/functionalscripts/CreateTablesonly.sql");
        DatabaseScript = DatabaseScript.Replace("DatabaseNametoChange", DatabaseName);
        return ActionQueryDB(DatabaseScript, ConnectionString);


 public bool ActionQueryDB(string SQLStatement, string ConnectionString)
        //  SqlConnection cn;

        OleDbConnection cn = new OleDbConnection();

        cn.ConnectionString = ConnectionString;
            OleDbCommand cmd = new OleDbCommand();
            cmd.CommandText = SQLStatement;
            cmd.Connection = cn;

            return true;
        catch (Exception ex)

            return false;


****************** Contents of text file appe

Cannot create database diagrams for sqlexpress .mdf file in Visual studio server explorer



I've look around the forums but I can't get the solution for my problem. I've installed Visual studio 2010 with sqlexpress edition. Then I have renamed my computer. After renaming my computer I've deleted the directory C:\Users\uporabnik\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. After restart, I have started VS2010, open Server explorer and I've added the connection to a new database. I've been able to add new tabels, bu when I've tried to add a diagram, it didn't work. In properties window od the database I saw, the the database owner was oldComputerName\username not newComputerName\userName. In sql server management studio I've reanmed the user oldComputerName\userName to newComputerName\userName. After attaching the database it worked fine.

I've returned to Visual studio 2010. When creating new database, the owner of new database is oldComputerName\userName. The next tip was renaming the  SQLServerMSSQLUser$ComputerName$SQLEXPRESS(and other names with sql...) in Local Users and gorups in Mange My computer. After restarting the compter I've got the same result. When creating new .mdf file in server explorer of visual studio, the database owner is oldComputerName\userName.<

How to take backup of single table in SQL server 2008 and SQL Server Management Studio Environment



I know how to take total database backup in SQL server 2008 and SQL Server Management Studio Environment but i failed to take single table backup in database.

It is possible to take single table backup in Oracle using PL/SQL Developer IDE.

Thanks in Advance..... 

set up database with .bak files in SAL server management studio



I need to connect to 3 remote databases from my local machine and  restore 3 .bak files, one for each database.

I am new to asp and sql server and am finding SQL Server Management studio quite confusing.  I cannot find any options to connect remotely or restore a database from .bak.

Many thanks

Adding a new field to a table via script in sql server management studio

I know how you can script to and create a new table but how about adding a new field to this table? For example: how would i add a new varchar(50) field named mynewfield?

USE [example]
/****** Object: Table [dbo].[Password]  Script Date: 10/26/2010 10:17:30 ******/
CREATE TABLE [dbo].[Password](
	[user_id] [int] NOT NULL,
	[password] [varchar](30) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response1] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response2] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response3] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[user_id] ASC

ALTER TABLE [dbo].[Password] WITH CHECK ADD CONSTRAINT [User_Password_FK1] FOREIGN KEY([user_id])
REFERENCES [dbo].[User] ([id])
ALTER TABLE [dbo].[Password] CHECK CONSTRAINT [User_Password_FK1]

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend