Re: Creating a database



Adrian,

Try something as this from an old program of me,

cmd.CommandText = _
"CREATE PROCEDURE InsertMessage " & vbCrLf & _
"@Answer ntext, " & _
"@Problem nvarchar " & vbCrLf & _
"AS" & vbCrLf & _
"INSERT INTO tblMessages (Problem, Answer) VALUES (@Problem, @Answer)"
cmd.ExecuteNonQuery()

I hope this helps,

Cor


"Adrian" <00@xxxxx> schreef in bericht
news:45138b7c$0$739$5fc3050@xxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a text on Stored Procedures.

My questions were the following

(1.) The code below does not have "CREATE PROCEDURE" in it, as my text on
SP
tells me Stored Procedures should have.
Question: "Is the code below a Stored Procedure after all?" Yes / No.

The code:

USE master
GO
CREATE DATABASE Products
ON
( NAME = prods_dat,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\prods.mdf',
SIZE = 4,
MAXSIZE = 10,
FILEGROWTH = 1 )
GO

Answer "No"
(2.) The code has been taken from MDSN and is Transact SQL. If it isn't a
SP
then I should be able to stick the code into a CommandText string and do
an
ExecuteNocQuery. However if I want to create a database, that database is
not going to be there in the first place, so what do I put in the connect
string, since the connect string has to specify a database name?

Answer "Yes"
Question A.
Stored Proceduers seem to need "CREATE STORED PROCEDURE".
Question: how do I get the code to comply to the stored procedure cyntax?

Question B.
I can create a stored procedure from within the Server Explorer and from
SQL
Server Manager Studio Express. From within VS I have to follow this route
according to a text I have: File -> New Project -> C# ->Database -> SQL
Server Project. I do not have these options in my VS Standard Edition. Is
it
still possible to create a SP in my VS Standard Edition without these
options (not using the two methods I have already stated, viz: from within
the Server Explorer and from SQL Server Manager Studio Express)?




.



Relevant Pages

  • Re: Creating a database
    ... Please do yourself a favor, find a local user group, or buy a beginning book on SQL Server or take a class, you will save yourself a great deal of pain in the long run. ... CREATE DATABASE Products ... I can create a stored procedure from within the Server Explorer and from ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Help with SQL 2005 and Sourcesafe 6
    ... I understand where you're coming from but if you open up the .sql script ... stored procedure in the database that it belongs to. ...
    (microsoft.public.sqlserver.tools)
  • Re: Ad Hoc Query in C#
    ... I always like to put as much logic in the database as possible, ... tradeoff is the programmer cannot see what is going on in the database. ... or just parameterize his string sql query. ... > Putting logic like this in a stored procedure isn't alway to my liking ...
    (microsoft.public.dotnet.general)
  • Re: Alternative to Dynamic SQL?
    ... If security is that much of a concern, shutdown your sql ... each database is suppose to have an application ... search querying using stored procedure and found it invalid. ... dynamic SQL, modern database engines actually cache dynamic sql and ...
    (microsoft.public.sqlserver.programming)
  • Re: Second SQL adapter on the same database
    ... stored procedure from a particular remote SQL Server 2000 database via a SQL ... connect two or more SQL adapter receive locations to a database, ...
    (microsoft.public.biztalk.general)