Create Database
Apr 1, 2003
Hi,
Just a quick question. I am trying to create a database by specifying only the size (not the path) (using the 'Size' keyword).
here is what I am trying to do
CREATE DATABASE JIM
ON
(Name = Jim.dat,
size = 10)
LOG ON
(Name = 'Jim.Log',
size = 2)
Is this possible? What is the syntax?
Thanks,
jim
View 2 Replies
ADVERTISEMENT
Oct 2, 2007
I am using SQL express and Visual web developer on windows Vista.
When I try to create a new database the following message appears.
CREATE DATABASE permission denied in database master (error 262)
I log on to my computer as an administrator.
Help appreciated
Prontonet
View 4 Replies
View Related
May 20, 2008
the subject pretty much says it all, I want to be able to do the following in in VB.net code):
{[If [table with this name] already exists [in this sql database] then [ don't create another one] else [create it and populate it with these values]}
How would I do this?
View 3 Replies
View Related
Jul 20, 2005
Can I dynamically (from a stored procedure) generatea create table script of all tables in a given database (with defaults etc)a create view script of all viewsa create function script of all functionsa create index script of all indexes.(The result will be 4 scripts)Arno de Jong,The Netherlands.
View 1 Replies
View Related
Jul 20, 2005
I have some code that dynamically creates a database (name is @FullName) andthen creates a table within that database. Is it possible to wrap thesethings into a transaction such that if any one of the following fails, thedatabase "creation" is rolledback. Otherwise, I would try deleting on errordetection, but it could get messy.IF @Error = 0BEGINSET @ExecString = 'CREATE DATABASE ' + @FullNameEXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'CREATE TABLE ' + @FullName + '.[dbo].[Image] ( [ID][int] IDENTITY (1, 1) NOT NULL, [Blob] [image] NULL , [DateAdded] [datetime]NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'ALTER TABLE ' + @FullName + '.[dbo].[Image] WITHNOCHECK ADD CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED ( [ID] ) ON[PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorEND
View 2 Replies
View Related
Mar 26, 2008
I'm new to using SSIS and have been reading and learning slowly how to use it. I'm trying to create an identical copy of our database for reporting. I've used the Import/Export wizard, but have had some issues with foreign keys and with sql_variant columns.
I've tried searching for anything but haven't had any luck as of yet. I guess I don't even know where to start or what to look for.
Any help would be appreciated. Thanks!
View 9 Replies
View Related
Sep 10, 2012
We have a SQL database that uses Active Directory with Windows Authentication. Can users that are members of the Active Directory group that has read/write access to the SQL database create ODBC connections to access the database directly and update the data? They dont have individual logins on the server. They are only members of the Active Directory group that has a login?
View 1 Replies
View Related
Jul 15, 2015
I am setting up SQL audit on sql servers in my environment based on requirement. I want to create database specifications ASAP database created. I tried DDL trigger but Audit doesn't support triggers. So I created audit specifications on model database. the only problem with this is every specification created on new database with same name.database specification name includes newly created database name or other methods to create database specifications on newly created databases.
View 6 Replies
View Related
Feb 20, 2007
Hi, My server went dead(problems with the hard disk), but I have a copy of the whole sql server directory including the database in a external hard disk. I have a new server now and I would like to copy this database (with the reports from reporting services too) from the external hard disk to my new server. can anybody help me please? Thanks.
Note : I have a plain copy of all the sql server directory with all the files including the database not a SQLServer backup done with the wizards.
View 1 Replies
View Related
Feb 17, 2007
Cn not do anything with my sql server, everything i trt to do i get this message, user does not have permision, etc, ,
I am running windows Vista Business, SQL SERVER 2005
so what going on here
View 23 Replies
View Related
Feb 1, 2007
got rid of my error about user login rights, it was all working yesterday. but for some reason i now get this error CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:InetpubwwwrootsqlSiteApp_DatasiteDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:InetpubwwwrootsqlSiteApp_DatasiteDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:InetpubwwwrootsqlSiteApp_DatasiteDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734995
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
i have this in my web.config file <connectionStrings> <add name="ConnectionStringTest" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=C:InetpubwwwrootsqlSiteApp_DatasiteDB.mdf;Integrated Security=SSPI;Connect Timeout=30;User Instance=False" providerName="System.Data.SqlClient" /> </connectionStrings> <appSettings /> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true" /> <identity impersonate="true"/> and my asp connection string is <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringTest %>" SelectCommand="SELECT [entryID], [compID], [emailAddy], [answer] FROM [entry]"></asp:SqlDataSource> if i set user instance to true i get a user permission error. it says on sql server management that i have dbo rights on my database, but it wont let me put datareader or write on this login. any ideas? its driving me insane
View 4 Replies
View Related
Oct 26, 2015
I have installed new SQLServer2012 instance and my domain user have sysadmin privileges on this instance. I have a restore procedure and it will execute WITH EXECUTE AS 'domainmy username', for all the developers have exec permissions to this procedure. But newly installed server this procedure was failing with the following message. But the same procedure executing fine on other servers.
Msg 262, Level 14, State 1, Line 1
CREATE DATABASE permission denied in database 'master'.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
View 7 Replies
View Related
Nov 10, 2006
Hi there
I am working on Visual Web Developer Express Edition 2005. When I right click on database explorer to create an SQL server database then I always find the option " Create New SQL Server database " Disabled.
Can any one tell me how to enable that option please ?
View 4 Replies
View Related
Oct 11, 2006
Cann someone pls tell me how to create a database in visual studio 2005. :o
View 6 Replies
View Related
Oct 9, 2006
I have an application that creates a new database during installation,and I've noticed some strange behavior. Once I've created thedatabase, I am able to immediately create tables and populate lookupdata, provided I remain connected to the server. If, however, Idisconnect and attempt to reconnect immediately, I'll get an errorsaying that my login is invalid for the new database.I can get around this by having my code simply wait 5 seconds beforeattempting to reconnect, but I'm curious to see if anybody here cangive an explaination for why this is happening. Here is a bit ofpseudo code to explain what I'm seeing:open new connectioncreate databasecreate tablespopulate tablesclose connection// open new connection /* can't do this yet, as it would break */for (int a=0; a<5; a++){Thread.Sleep(2000)try{open new connectionbreak;}catch{Debug("still waiting...");}}Running my version of this code, I'll see that "still waiting..."message go past 2-3 times before SQL Server wakes up and realizes thatI'm allowed to connect to it. Anybody know why?Thanks,Jason KesterExpat Software Consulting Serviceshttp://www.expatsoftware.com/---Get your own Travel Blog, with itinerary maps and photos!http://www.blogabond.com/
View 1 Replies
View Related
Dec 20, 2006
Hi,
I'm using Visual Studio 2005 Pro and SQLExpress that comes with it.
I have my program running fine in XP Pro OS using a window user "Glen" (Computer administrator) with Administrator rights. This means that I installed VS 2005 using this window user "Glen"
I created another windows user "TestUser" (Limited account) in the same physical PC.
I tried to run the program and on the part that I need to access SQL table, I got the error [CREATE DATABASE permission denied in database 'master']
At the same time while using "TestUser" and running sqlcmd (to check if I can connect to SQL), I also got error HResult 0x2, Level 16, State 1.
I read alot on MSDN discussions and related links but it seems that I can't get the solution that I need.
SO HERE ARE MY QUESTIONS :
1. Am I allowed to run my program using user "TestUser" since SQL is installed using "Glen" windows user?
2. Do I need to add access rights to "TestUser" to allow the user to have CREATE rights? (Note : for security reason, I can add other access rights except Administrator)
Thanks in advance for all you help.
View 19 Replies
View Related
Jun 10, 2001
I am a beginner in learning SQLServer 7.And I learn it by using its own help file.
The only problem troubles me is that after I do some options in database diagram,there's nothing happen.And then no matter what I do,database diagram panel is always blank.
View 2 Replies
View Related
Nov 9, 1999
Hi.. i have created a project which uses SQL 7 as a database and have finished it. MY supervisor wants me
to create a wizard that will be able to install the database on any NT 4.0 machine. How do i start and go about doing
it
Please help
thanks
View 1 Replies
View Related
Aug 25, 2000
I am using SQL 6.5. Can I create a database and Alter the same
database in one SQL Script?
Thanks in advance.
View 1 Replies
View Related
Jul 2, 2007
I installed IIS Manager to my Vista PC and then SQL Server 2005 Express and SQL Server Management Studio Express using Windows Authentication. I could successfully connect to SQL Server. However, when I tried to create a new database, I got the error:
CREATE DATABASE permission denied in database ‘master’
I searched mant forums thru web about this error but could not find a resolution. I have BUILTINUsers and sa in the Logins under Security. But BUILTINUsers is not in any Server Roles. I tried to add it to public or dbcreator but was not allowed to do so, while sa is only in sysadmin.
Anybody could help me solve this program? Thanks.
View 1 Replies
View Related
Jul 2, 2007
I installed IIS Manager to my Vista PC and then SQL Server 2005 Express and SQL Server Management Studio Express using Windows Authentication. I could successfully connect to SQL Server. However, when I tried to create a new database, I got the error:
CREATE DATABASE permission denied in database ‘master’
I searched mant forums thru web about this error but could not find a resolution. I have BUILTINUsers and sa in the Logins under Security. But BUILTINUsers is not in any Server Roles. I tried to add it to public or dbcreator but was not allowed to do so, while sa is only in sysadmin.
Anybody could help me solve this program? Thanks.
View 1 Replies
View Related
Jul 10, 2007
how can I create a database synonym for the actual database name?
View 3 Replies
View Related
Jan 3, 2008
CREATE DATABASE ApressFinancial ON PRIMARY ( NAME = N'ApressFinancial', FILENAME = N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDATAApressFinancial.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'ApressFinancial_log', FILENAME = N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDATAApressFinancial_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) COLLATE SQL_Latin1_General_CP1_CI_ASGO
Hi All, what highlighted statement does in the above statement.
Regards
Abdul
View 1 Replies
View Related
May 29, 2006
I am getting the following message while creating SQL Database on my local machine in Visual Studio:An error has occured while establishing a connection to the server. When connecting to SQL Sever 2005, this failure may be caused by the fact that under the default settings SQL Sever does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Sever/Instance Specified)
View 1 Replies
View Related
May 31, 2006
Please how best is it to create a database with SQL SERVER Express. I use it but with the management studio
View 1 Replies
View Related
Oct 20, 1999
If I just execute 'create database db_name', then the files are created in the c:mssqdata directory. Is there a way, I can default this, so when I create a databse without the paramaters, the files will be created (for example) in d:sql70data ?
Thanks in advance
View 3 Replies
View Related
Jul 6, 1999
I want to create a database. in this database will have a person table (id, ssn, fname,lname, address,city,state,country, zip ....) and
student, customer, instructor, author which will inherit the attributes from person and have their own attributes. how can I do? what kind of PK I should choose?
thanks!
Cindy
View 2 Replies
View Related
Jan 12, 2007
Can some one tell me how to build a database
I'd like to build it using assembler
http://en.wikipedia.org/wiki/Assembler
How can you do that?
View 14 Replies
View Related
Jan 4, 2007
Hi I run this script:
create database mosaikDB2
use mosaikDB2
but it returns this error:
Msg 911, Level 16, State 1, Line 2
Could not locate entry in sysdatabases for database 'mosaikDB2'. No entry found with that name. Make sure that the name is entered correctly.
The problem is that I have no database called mosaikDB2.
If i run only create database mosaikDB2, it works without a problem
pls try it: try creating any new database and using it right away u ll get an error.
what should i do to avoid this.
Thanks a lot.
View 4 Replies
View Related
Jan 23, 2008
Hi Guys,
Is there a simple script to create an SQL Database I want to run the script using osql
Thanks for your help.
Best Regards,
Steve Wilson.
Steve
View 2 Replies
View Related
Nov 30, 2006
Hi,I am trying to:1. Create a SQL database (I am working with SQL 2005 Express)2. with a C# code3. when the user is not the computer administrator.I have managed to create the database file (code below). I am not sureit is the right way.Can you take a look please?I would like to either create a password for these database or aspecial user so only mysoftware will be able to control it (change data). How do I do that?tmpConn.ConnectionString = "Data Source=(local); DATABASE =master;Integrated Security=True; user instance=true";sqlCreateDBQuery = " CREATE DATABASE " + DBParam.DatabaseName +" ONPRIMARY "+ " (NAME = " +DBParam.DataFileName +", "+ " FILENAME = '" +DBParam.DataPathName +"', "+ " SIZE = 5MB,"+ " FILEGROWTH =" +DBParam.DataFileGrowth +") "+ " LOG ON (NAME =" +DBParam.LogFileName +", "+ " FILENAME = '" +DBParam.LogPathName + "', "+ " SIZE = 1MB, "+ " FILEGROWTH =" +DBParam.LogFileGrowth +") ";SqlCommand myCommand = new SqlCommand(sqlCreateDBQuery, tmpConn);try{tmpConn.Open();MessageBox.Show(sqlCreateDBQuery);myCommand.ExecuteNonQuery();MessageBox.Show("Database has been created successfully!","CreateDatabase", MessageBoxButtons.OK, MessageBoxIcon.Information);}catch (System.Exception ex){MessageBox.Show(ex.ToString(), "Create Database",MessageBoxButtons.OK, MessageBoxIcon.Information);}finally{tmpConn.Close();}
View 1 Replies
View Related
Feb 19, 2007
Hi,
I am just starting to use VS2005 and SQL Server Express 2005. One of the tutorials I've been looking at asks me to add a new Database Item by right clicking on my project and choosing Add Item, then SQL Database.
If I try and do this I get the following error:
Failed to generate a user instanceof SQL Server due to a failure in starting the process for the user instance. The Connection will be closed.
I have searched and found there is a similar problem down to trying to do this remotely, I have carried out their suggestions of changing the built in account to "Local System" in the SQL Server Express 2005 Properties. And also delete the folder SQL SERVER in the Microsoft folder in Application Data. But this hasn't worked and I still get the error.
If I try and create a new database in the Server explorer by right clicking and selecting "Create New SQL Server Database..." This works fine.
First of all, can anyone give me any suggestions to solve my problem? And secondly, can anyone tell me why I would use an .mdf file as opposed to creating a new SQL Server Database?
Thanks in advance...
JohnnyC
View 1 Replies
View Related
May 22, 2008
Hi,
I want to create a database through command prompt
utility.How to properly manage this database?
pls give me steps for creating database in command prompt
View 6 Replies
View Related