Showing posts with label statements. Show all posts
Showing posts with label statements. Show all posts

Wednesday, March 7, 2012

Newbie - Student - Help

I am working on an assignment that was due at midnight. The question is usi
ng the "Northwind database write the following SQL statements to be executed
against on of the tables within the "Northwind database"
a.) Alter a table and add a column
b.) Alter a table and add a constraint
c.) Alter a table and add an index
What I have so far is:
USE Northwind
ALTER TABLE Employees ADD COLUMN TerminationDate DateTime NULL
Server: Msg 156, Level 15, State 1, Line 3
I keep getting "Incorrect syntax near the keyword 'COLUMN'"
What am I doing wrong? If I can not get part 'a' then I will never get the
rest of the assignment.
Thanks in advance,
Deanna
UoP Student
deannac24@.cableone.netI am using SQL Query Analyzer
--
Deanna
UoP Student
deannac24@.cableone.net
"Deanna Cusic" <deannac24@.cableone.net> wrote in message news:11lh29913e9ngd
5@.corp.supernews.com...
I am working on an assignment that was due at midnight. The question is usi
ng the "Northwind database write the following SQL statements to be executed
against on of the tables within the "Northwind database"
a.) Alter a table and add a column
b.) Alter a table and add a constraint
c.) Alter a table and add an index
What I have so far is:
USE Northwind
ALTER TABLE Employees ADD COLUMN TerminationDate DateTime NULL
Server: Msg 156, Level 15, State 1, Line 3
I keep getting "Incorrect syntax near the keyword 'COLUMN'"
What am I doing wrong? If I can not get part 'a' then I will never get the
rest of the assignment.
Thanks in advance,
Deanna
UoP Student
deannac24@.cableone.net|||Deanna Cusic skrev:

> What I have so far is:
> USE Northwind
> ALTER TABLE Employees ADD COLUMN TerminationDate DateTime NULL
>
> Server: Msg 156, Level 15, State 1, Line 3
> I keep getting "Incorrect syntax near the keyword 'COLUMN'"
>
Have you checked Books online, the help that comes with SQL Server?
Using that you should be able to work the syntax out! Or check eg.
http://msdn.microsoft.com/library/d...
server2000.asp
if you don't have access to BOL.
Other than that, try losing the 'COLUMN' part.
/impslayer, aka Birger Johansson|||"impslayer" <impslayer@.hotmail.com> wrote in message
news:1129876626.682799.308040@.f14g2000cwb.googlegroups.com...
> Deanna Cusic skrev:
>
> Have you checked Books online, the help that comes with SQL Server?
> Using that you should be able to work the syntax out! Or check eg.
> http://msdn.microsoft.com/library/d...lserver2000.asp
> if you don't have access to BOL.
> Other than that, try losing the 'COLUMN' part.
> /impslayer, aka Birger Johansson
>
Thank you, all I did is take out 'COLUMN' and it works. I have been
wracking my brain for hours over this.
Deanna
UoP Student
deannac24@.cableone.net|||OK, thanks for your help so far but now I am stuck on the final one. I am
trying to add an index. So far I have:
use Northwind
ALTER TABLE Employees ADD [idxAddress] nvarchar(60), Address nvarchar(60)
the error I get is
Server: Msg 2705, level 16, State 4, Line 3
Column names in each table must be unique. Column name 'Address' in table
'Employees' is specified more than once.
I have tried this on many different fields including the primary keys and
still get this same error. I have even pulled up the data to check for
replication and did not find any. I am lost. I finally, thanks to help,
have part a and b, however I need part c. When I get that I can actually
get some sleep before the sun, and my children, get up ;-)
--
Deanna
"Deanna Cusic" <deannac24@.cableone.net> wrote in message
news:11lh4epilg52q9b@.corp.supernews.com...
> "impslayer" <impslayer@.hotmail.com> wrote in message
> news:1129876626.682799.308040@.f14g2000cwb.googlegroups.com...
> Thank you, all I did is take out 'COLUMN' and it works. I have been
> wracking my brain for hours over this.
> Deanna
> UoP Student
> deannac24@.cableone.net
>|||Deanna Cusic skrev:

> OK, thanks for your help so far but now I am stuck on the final one. I am
> trying to add an index. So far I have:
> use Northwind
> ALTER TABLE Employees ADD [idxAddress] nvarchar(60), Address nvarchar(60)
>
You should look for help on creating an index, not 'ALTER TABLE'...
The assignment question seemed to indicate an 'ALTER TABLE', but
you should really search for help on 'index' instead, that would
give you your desired answer!
Without Books online, you might check out:
http://msdn.microsoft.com/library/d...r />
_64l4.asp
/impslayer, aka Birger Johansson

Monday, February 20, 2012

Newbee questions

I am trying to execute these set of statements...
CREATE DATABASE Sales1
ON
PRIMARY(NAME=SalesPrimary,
FILENAME='C:\Kim\SalesPrimary.mdf',
SIZE = 500MB,
MAXSIZE = 200,
FILEGROWTH = 20),
FILEGROUP SalesFG
(NAME = SalesData1,
FILENAME = 'C:\Kim\SalesData1.ndf',
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100),
(FILENAME='C:\Kim\SalesData2.ndf',
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300),
FILEGROUP SalesHistoryFG
(NAME = SalesHistory1,
FILENAME='C:\Kim\SalesHistory1.ndf',
SIZE=100MB,
MAXSIZE=500,
FILEGROWTH=50)
LOG ON
(NAME=Archlog1,
FILENAME='C:\Kim\SalesLog.ldf',
SIZE=300MB,
MAXSIZE=800,
FILEGROWTH=100)
I am using SSMS and typind this in the New Query Editor window.
But when I execute it...it gives me an error saying...
Msg 1036, Level 16, State 2, Line 1
File option NAME is required in this CREATE/ALTER DATABASE statement.
But I already gave the database name as SALES1...what is the problem
here?
Appreciate your help
Thanks in advance!
Just glancing, it looks like the NAME is missing for salesdata2.ndf
No idea if the rest is correct or not...
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
Real-world stuff I run across with SQL Server:
http://kevin3nf.blogspot.com
"freeblue11" <freeblue11@.gmail.com> wrote in message
news:1164656369.028134.98250@.j72g2000cwa.googlegro ups.com...
>I am trying to execute these set of statements...
> CREATE DATABASE Sales1
> ON
> PRIMARY(NAME=SalesPrimary,
> FILENAME='C:\Kim\SalesPrimary.mdf',
> SIZE = 500MB,
> MAXSIZE = 200,
> FILEGROWTH = 20),
> FILEGROUP SalesFG
> (NAME = SalesData1,
> FILENAME = 'C:\Kim\SalesData1.ndf',
> SIZE = 200MB,
> MAXSIZE = 800,
> FILEGROWTH = 100),
> (FILENAME='C:\Kim\SalesData2.ndf',
> SIZE = 400MB,
> MAXSIZE = 1200,
> FILEGROWTH = 300),
> FILEGROUP SalesHistoryFG
> (NAME = SalesHistory1,
> FILENAME='C:\Kim\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50)
> LOG ON
> (NAME=Archlog1,
> FILENAME='C:\Kim\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100)
> I am using SSMS and typind this in the New Query Editor window.
> But when I execute it...it gives me an error saying...
> Msg 1036, Level 16, State 2, Line 1
> File option NAME is required in this CREATE/ALTER DATABASE statement.
> But I already gave the database name as SALES1...what is the problem
> here?
> Appreciate your help
> Thanks in advance!
>
|||Kevin, Arnie
My oversite!!
Thank you very much!
Arnie Rowland wrote:
> Good formatting often makes things so easy to see. Notes inline...
> CREATE DATABASE Sales1
> ON PRIMARY
> ( NAME=SalesPrimary,
> FILENAME='D:\Temp\SalesPrimary.mdf',
> SIZE = 500MB,
> MAXSIZE = 500, --Maxsize has to be at least the same as Size
> FILEGROWTH = 20
> ),
> FILEGROUP SalesFG
> ( NAME = SalesData1,
> FILENAME = 'D:\Temp\SalesData1.ndf',
> SIZE = 200MB,
> MAXSIZE = 800,
> FILEGROWTH = 100
> ),
> ( , --Missing Filename here
> FILENAME='D:\Temp\SalesData2.ndf',
> SIZE = 400MB,
> MAXSIZE = 1200,
> FILEGROWTH = 300
> ),
> FILEGROUP SalesHistoryFG
> ( NAME = SalesHistory1,
> FILENAME='D:\Temp\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50
> )
> LOG ON
> ( NAME=Archlog1,
> FILENAME='D:\Temp\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100
> )
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
> You can't help someone get up a hill without getting a little closer to the top yourself.
> - H. Norman Schwarzkopf
>
> "freeblue11" <freeblue11@.gmail.com> wrote in message news:1164656369.028134.98250@.j72g2000cwa.googlegro ups.com...
> --=_NextPart_000_07DC_01C7121B.7A817570
> Content-Type: text/html; charset=iso-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 5412
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
> <META content="MSHTML 6.00.5730.11" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY>
> <DIV><FONT face=Arial size=2>Good formatting often makes things so easy to see.
> Notes inline...</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face="Courier New" size=2>CREATE DATABASE Sales1<BR>&nbsp;&nbsp; ON
> PRIMARY<BR>&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; (&nbsp;
> NAME=SalesPrimary,<BR>&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;
> FILENAME='D:\Temp\SalesPrimary.mdf',<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
> SIZE = 500MB,<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; MAXSIZE =
> 500,&nbsp; --Maxsize has to be at least the same as
> Size<BR>&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp; FILEGROWTH =
> 20<BR>&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp; ),<BR>&nbsp;&nbsp; FILEGROUP
> SalesFG<BR>&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; (&nbsp; NAME =
> SalesData1,<BR>&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILENAME =
> 'D:\Temp\SalesData1.ndf',<BR>&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;
> SIZE = 200MB,<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; MAXSIZE =
> 800,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp; FILEGROWTH =
> 100<BR>&nbsp;&nbsp;&nbsp;&nbsp;&am p;nbsp; ),<BR>&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;
> (&nbsp; , --Missing Filename
> here<BR>&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;
> FILENAME='D:\Temp\SalesData2.ndf',<BR>&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;
> SIZE = 400MB,<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; MAXSIZE =
> 1200,<BR>&nbsp;&nbsp;&nbsp;&nbsp;& amp;nbsp;&nbsp;&nbsp;&nbsp; FILEGROWTH =
> 300<BR>&nbsp;&nbsp;&nbsp;&nbsp;&am p;nbsp; ),<BR>&nbsp;&nbsp; FILEGROUP
> SalesHistoryFG<BR>&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp; (&nbsp; NAME =
> SalesHistory1,<BR>&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> FILENAME='D:\Temp\SalesHistory1.ndf',<BR>&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;
> SIZE=100MB,<BR>&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> MAXSIZE=500,<BR>&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> FILEGROWTH=50<BR>&nbsp;&nbsp;&nbsp;&am p;nbsp;&nbsp; )<BR>&nbsp;&nbsp; LOG
> ON<BR>&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp; (&nbsp;
> NAME=Archlog1,<BR>&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> FILENAME='D:\Temp\SalesLog.ldf',<BR>&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;
> SIZE=300MB,<BR>&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> MAXSIZE=800,<BR>&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> FILEGROWTH=100<BR>&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp; )</FONT></DIV>
> <DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
> <DIV><BR><FONT face=Arial size=2>-- <BR>Arnie Rowland, Ph.D.<BR>Westwood
> Consulting, Inc</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>Most good judgment comes from experience. <BR>Most
> experience comes from bad judgment. <BR>- Anonymous</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>You can't help someone get up a hill without
> getting a little closer to the top yourself.<BR>- H. Norman
> Schwarzkopf</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>"freeblue11" <</FONT><A
> href="http://links.10026.com/?link=mailto:freeblue11@.gmail.com"><FONT face=Arial
> size=2>freeblue11@.gmail.com</FONT></A><FONT face=Arial size=2>> wrote in
> message </FONT><A
> href="http://links.10026.com/?link=news:1164656369.028134.98250@.j72g2000cwa.goo glegroups.com"><FONT
> face=Arial
> size=2>news:1164656369.028134.98250@.j72g2000cwa.go oglegroups.com</FONT></A><FONT
> face=Arial size=2>...</FONT></DIV><FONT face=Arial size=2>>I am trying to
> execute these set of statements...<BR>> <BR>> CREATE DATABASE
> Sales1<BR>> ON<BR>> PRIMARY(NAME=SalesPrimary,<BR>>
> FILENAME='C:\Kim\SalesPrimary.mdf',<BR>> SIZE = 500MB,<BR>> MAXSIZE =
> 200,<BR>> FILEGROWTH = 20),<BR>> FILEGROUP SalesFG<BR>> (NAME =
> SalesData1,<BR>> FILENAME = 'C:\Kim\SalesData1.ndf',<BR>> SIZE =
> 200MB,<BR>> MAXSIZE = 800,<BR>> FILEGROWTH = 100),<BR>>
> (FILENAME='C:\Kim\SalesData2.ndf',<BR>> SIZE = 400MB,<BR>> MAXSIZE =
> 1200,<BR>> FILEGROWTH = 300),<BR>> FILEGROUP SalesHistoryFG<BR>> (NAME
> = SalesHistory1,<BR>> FILENAME='C:\Kim\SalesHistory1.ndf',<BR>>
> SIZE=100MB,<BR>> MAXSIZE=500,<BR>> FILEGROWTH=50)<BR>> LOG ON<BR>>
> (NAME=Archlog1,<BR>> FILENAME='C:\Kim\SalesLog.ldf',<BR>>
> SIZE=300MB,<BR>> MAXSIZE=800,<BR>> FILEGROWTH=100)<BR>> <BR>> I am
> using SSMS and typind this in the New Query Editor window.<BR>> But when I
> execute it...it gives me an error saying...<BR>> <BR>> Msg 1036, Level 16,
> State 2, Line 1<BR>> File option NAME is required in this CREATE/ALTER
> DATABASE statement.<BR>> But I already gave the database name as
> SALES1...what is the problem<BR>> here?<BR>> <BR>> Appreciate your
> help<BR>> <BR>> Thanks in advance!<BR>></FONT></BODY></HTML>
> --=_NextPart_000_07DC_01C7121B.7A817570--

Newbee questions

I am trying to execute these set of statements...
CREATE DATABASE Sales1
ON
PRIMARY(NAME=SalesPrimary,
FILENAME='C:\Kim\SalesPrimary.mdf',
SIZE = 500MB,
MAXSIZE = 200,
FILEGROWTH = 20),
FILEGROUP SalesFG
(NAME = SalesData1,
FILENAME = 'C:\Kim\SalesData1.ndf',
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100),
(FILENAME='C:\Kim\SalesData2.ndf',
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300),
FILEGROUP SalesHistoryFG
(NAME = SalesHistory1,
FILENAME='C:\Kim\SalesHistory1.ndf',
SIZE=100MB,
MAXSIZE=500,
FILEGROWTH=50)
LOG ON
(NAME=Archlog1,
FILENAME='C:\Kim\SalesLog.ldf',
SIZE=300MB,
MAXSIZE=800,
FILEGROWTH=100)
I am using SSMS and typind this in the New Query Editor window.
But when I execute it...it gives me an error saying...
Msg 1036, Level 16, State 2, Line 1
File option NAME is required in this CREATE/ALTER DATABASE statement.
But I already gave the database name as SALES1...what is the problem
here'
Appreciate your help
Thanks in advance!Just glancing, it looks like the NAME is missing for salesdata2.ndf
No idea if the rest is correct or not...
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
Real-world stuff I run across with SQL Server:
http://kevin3nf.blogspot.com
"freeblue11" <freeblue11@.gmail.com> wrote in message
news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com...
>I am trying to execute these set of statements...
> CREATE DATABASE Sales1
> ON
> PRIMARY(NAME=SalesPrimary,
> FILENAME='C:\Kim\SalesPrimary.mdf',
> SIZE = 500MB,
> MAXSIZE = 200,
> FILEGROWTH = 20),
> FILEGROUP SalesFG
> (NAME = SalesData1,
> FILENAME = 'C:\Kim\SalesData1.ndf',
> SIZE = 200MB,
> MAXSIZE = 800,
> FILEGROWTH = 100),
> (FILENAME='C:\Kim\SalesData2.ndf',
> SIZE = 400MB,
> MAXSIZE = 1200,
> FILEGROWTH = 300),
> FILEGROUP SalesHistoryFG
> (NAME = SalesHistory1,
> FILENAME='C:\Kim\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50)
> LOG ON
> (NAME=Archlog1,
> FILENAME='C:\Kim\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100)
> I am using SSMS and typind this in the New Query Editor window.
> But when I execute it...it gives me an error saying...
> Msg 1036, Level 16, State 2, Line 1
> File option NAME is required in this CREATE/ALTER DATABASE statement.
> But I already gave the database name as SALES1...what is the problem
> here'
> Appreciate your help
> Thanks in advance!
>|||Good formatting often makes things so easy to see. Notes inline...
CREATE DATABASE Sales1
ON PRIMARY
( NAME=SalesPrimary,
FILENAME='D:\Temp\SalesPrimary.mdf',
SIZE = 500MB,
MAXSIZE = 500, --Maxsize has to be at least the same as Size
FILEGROWTH = 20
),
FILEGROUP SalesFG
( NAME = SalesData1,
FILENAME = 'D:\Temp\SalesData1.ndf',
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100
),
( , --Missing Filename here
FILENAME='D:\Temp\SalesData2.ndf',
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300
),
FILEGROUP SalesHistoryFG
( NAME = SalesHistory1,
FILENAME='D:\Temp\SalesHistory1.ndf',
SIZE=100MB,
MAXSIZE=500,
FILEGROWTH=50
)
LOG ON
( NAME=Archlog1,
FILENAME='D:\Temp\SalesLog.ldf',
SIZE=300MB,
MAXSIZE=800,
FILEGROWTH=100
)
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"freeblue11" <freeblue11@.gmail.com> wrote in message news:1164656369.028134.98250@.j72g2000cw
a.googlegroups.com...
>I am trying to execute these set of statements...
>
> CREATE DATABASE Sales1
> ON
> PRIMARY(NAME=SalesPrimary,
> FILENAME='C:\Kim\SalesPrimary.mdf',
> SIZE = 500MB,
> MAXSIZE = 200,
> FILEGROWTH = 20),
> FILEGROUP SalesFG
> (NAME = SalesData1,
> FILENAME = 'C:\Kim\SalesData1.ndf',
> SIZE = 200MB,
> MAXSIZE = 800,
> FILEGROWTH = 100),
> (FILENAME='C:\Kim\SalesData2.ndf',
> SIZE = 400MB,
> MAXSIZE = 1200,
> FILEGROWTH = 300),
> FILEGROUP SalesHistoryFG
> (NAME = SalesHistory1,
> FILENAME='C:\Kim\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50)
> LOG ON
> (NAME=Archlog1,
> FILENAME='C:\Kim\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100)
>
> I am using SSMS and typind this in the New Query Editor window.
> But when I execute it...it gives me an error saying...
>
> Msg 1036, Level 16, State 2, Line 1
> File option NAME is required in this CREATE/ALTER DATABASE statement.
> But I already gave the database name as SALES1...what is the problem
> here'
>
> Appreciate your help
>
> Thanks in advance!
>|||Kevin, Arnie
My oversite!!
Thank you very much!
Arnie Rowland wrote:
> Good formatting often makes things so easy to see. Notes inline...
> CREATE DATABASE Sales1
> ON PRIMARY
> ( NAME=SalesPrimary,
> FILENAME='D:\Temp\SalesPrimary.mdf',
> SIZE = 500MB,
> MAXSIZE = 500, --Maxsize has to be at least the same as Size
> FILEGROWTH = 20
> ),
> FILEGROUP SalesFG
> ( NAME = SalesData1,
> FILENAME = 'D:\Temp\SalesData1.ndf',
> SIZE = 200MB,
> MAXSIZE = 800,
> FILEGROWTH = 100
> ),
> ( , --Missing Filename here
> FILENAME='D:\Temp\SalesData2.ndf',
> SIZE = 400MB,
> MAXSIZE = 1200,
> FILEGROWTH = 300
> ),
> FILEGROUP SalesHistoryFG
> ( NAME = SalesHistory1,
> FILENAME='D:\Temp\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50
> )
> LOG ON
> ( NAME=Archlog1,
> FILENAME='D:\Temp\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100
> )
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
> You can't help someone get up a hill without getting a little closer to th
e top yourself.
> - H. Norman Schwarzkopf
>
> "freeblue11" <freeblue11@.gmail.com> wrote in message news:1164656369.02813
4.98250@.j72g2000cwa.googlegroups.com...
> --=_NextPart_000_07DC_01C7121B.7A817570
> Content-Type: text/html; charset=iso-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 5412
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
> <META content="MSHTML 6.00.5730.11" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY>
> <DIV><FONT face=Arial size=2>Good formatting often makes things so easy to
see.
> Notes inline...</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face="Courier New" size=2>CREATE DATABASE Sales1<BR> &
amp;nbsp; ON
> PRIMARY<BR> (
> NAME=SalesPrimary,<BR> &a
mp;nbsp;
> FILENAME='D:\Temp\SalesPrimary.mdf',<BR> &
;nbsp;
> SIZE = 500MB,<BR> &nb
sp; MAXSIZE =
> 500, --Maxsize has to be at least the same as
> Size<BR> &n
bsp; FILEGROWTH =
> 20<BR> ),<BR>&
amp;nbsp; FILEGROUP
> SalesFG<BR> (
NAME =
> SalesData1,<BR>  
; FILENAME =
> 'D:\Temp\SalesData1.ndf',<BR> &
nbsp;
> SIZE = 200MB,<BR> &nb
sp; MAXSIZE =
> 800,<BR> &n
bsp; FILEGROWTH =
> 100<BR> ),<BR>
> ( , --Missing Filename
> here<BR> &n
bsp;
> FILENAME='D:\Temp\SalesData2.ndf',<BR> &n
bsp;
> SIZE = 400MB,<BR> &nb
sp; MAXSIZE =
> 1200,<BR> &
nbsp; FILEGROWTH =
> 300<BR> ),<BR>
FILEGROUP
> SalesHistoryFG<BR> (&
;nbsp; NAME =
> SalesHistory1,<BR> &n
bsp;
> FILENAME='D:\Temp\SalesHistory1.ndf',<BR> &am
p;nbsp;
> SIZE=100MB,<BR>  
;
> MAXSIZE=500,<BR> &nbs
p;
> FILEGROWTH=50<BR> )<BR>&
amp;nbsp; LOG
> ON<BR> (
> NAME=Archlog1,<BR> &n
bsp;
> FILENAME='D:\Temp\SalesLog.ldf',<BR> &nbs
p;
> SIZE=300MB,<BR>  
;
> MAXSIZE=800,<BR> &nbs
p;
> FILEGROWTH=100<BR> )</FO
NT></DIV>
> <DIV><FONT face="Courier New" size=2></FONT> </DIV>
> <DIV><BR><FONT face=Arial size=2>-- <BR>Arnie Rowland, Ph.D.<BR>Westwood
> Consulting, Inc</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face=Arial size=2>Most good judgment comes from experience. <BR
>Most
> experience comes from bad judgment. <BR>- Anonymous</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face=Arial size=2>You can't help someone get up a hill without
> getting a little closer to the top yourself.<BR>- H. Norman
> Schwarzkopf</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face=Arial size=2>"freeblue11" <</FONT><A
> href="http://links.10026.com/?link=mailto:freeblue11@.gmail.com"><FONT face=Arial
> size=2>freeblue11@.gmail.com</FONT></A><FONT face=Arial size=2>> wrote i
n
> message </FONT><A
> href="http://links.10026.com/?link=news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com"><FONT
> face=Arial
> size=2>news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com</FONT></A
><FONT
> face=Arial size=2>...</FONT></DIV><FONT face=Arial size=2>>I am trying
to
> execute these set of statements...<BR>> <BR>> CREATE DATABASE
> Sales1<BR>> ON<BR>> PRIMARY(NAME=SalesPrimary,<BR>>
> FILENAME='C:\Kim\SalesPrimary.mdf',<BR>> SIZE = 500MB,<BR>> MAXSIZE
=
> 200,<BR>> FILEGROWTH = 20),<BR>> FILEGROUP SalesFG<BR>> (NAME =
> SalesData1,<BR>> FILENAME = 'C:\Kim\SalesData1.ndf',<BR>> SIZE =
> 200MB,<BR>> MAXSIZE = 800,<BR>> FILEGROWTH = 100),<BR>>
> (FILENAME='C:\Kim\SalesData2.ndf',<BR>> SIZE = 400MB,<BR>> MAXSIZE =
> 1200,<BR>> FILEGROWTH = 300),<BR>> FILEGROUP SalesHistoryFG<BR>>
(NAME
> = SalesHistory1,<BR>> FILENAME='C:\Kim\SalesHistory1.ndf',<BR>>
> SIZE=100MB,<BR>> MAXSIZE=500,<BR>> FILEGROWTH=50)<BR>> LOG ON<BR>
> (NAME=Archlog1,<BR>> FILENAME='C:\Kim\SalesLog.ldf',<BR>>
> SIZE=300MB,<BR>> MAXSIZE=800,<BR>> FILEGROWTH=100)<BR>> <BR>>
I am
> using SSMS and typind this in the New Query Editor window.<BR>> But whe
n I
> execute it...it gives me an error saying...<BR>> <BR>> Msg 1036, Lev
el 16,
> State 2, Line 1<BR>> File option NAME is required in this CREATE/ALTER
> DATABASE statement.<BR>> But I already gave the database name as
> SALES1...what is the problem<BR>> here'<BR>> <BR>> Appreciate
your
> help<BR>> <BR>> Thanks in advance!<BR>></FONT></BODY></HTML>
> --=_NextPart_000_07DC_01C7121B.7A817570--

Newbee questions

I am trying to execute these set of statements...
CREATE DATABASE Sales1
ON
PRIMARY(NAME=SalesPrimary,
FILENAME='C:\Kim\SalesPrimary.mdf',
SIZE = 500MB,
MAXSIZE = 200,
FILEGROWTH = 20),
FILEGROUP SalesFG
(NAME = SalesData1,
FILENAME = 'C:\Kim\SalesData1.ndf',
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100),
(FILENAME='C:\Kim\SalesData2.ndf',
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300),
FILEGROUP SalesHistoryFG
(NAME = SalesHistory1,
FILENAME='C:\Kim\SalesHistory1.ndf',
SIZE=100MB,
MAXSIZE=500,
FILEGROWTH=50)
LOG ON
(NAME=Archlog1,
FILENAME='C:\Kim\SalesLog.ldf',
SIZE=300MB,
MAXSIZE=800,
FILEGROWTH=100)
I am using SSMS and typind this in the New Query Editor window.
But when I execute it...it gives me an error saying...
Msg 1036, Level 16, State 2, Line 1
File option NAME is required in this CREATE/ALTER DATABASE statement.
But I already gave the database name as SALES1...what is the problem
here'
Appreciate your help
Thanks in advance!Just glancing, it looks like the NAME is missing for salesdata2.ndf
No idea if the rest is correct or not...
--
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
Real-world stuff I run across with SQL Server:
http://kevin3nf.blogspot.com
"freeblue11" <freeblue11@.gmail.com> wrote in message
news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com...
>I am trying to execute these set of statements...
> CREATE DATABASE Sales1
> ON
> PRIMARY(NAME=SalesPrimary,
> FILENAME='C:\Kim\SalesPrimary.mdf',
> SIZE = 500MB,
> MAXSIZE = 200,
> FILEGROWTH = 20),
> FILEGROUP SalesFG
> (NAME = SalesData1,
> FILENAME = 'C:\Kim\SalesData1.ndf',
> SIZE = 200MB,
> MAXSIZE = 800,
> FILEGROWTH = 100),
> (FILENAME='C:\Kim\SalesData2.ndf',
> SIZE = 400MB,
> MAXSIZE = 1200,
> FILEGROWTH = 300),
> FILEGROUP SalesHistoryFG
> (NAME = SalesHistory1,
> FILENAME='C:\Kim\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50)
> LOG ON
> (NAME=Archlog1,
> FILENAME='C:\Kim\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100)
> I am using SSMS and typind this in the New Query Editor window.
> But when I execute it...it gives me an error saying...
> Msg 1036, Level 16, State 2, Line 1
> File option NAME is required in this CREATE/ALTER DATABASE statement.
> But I already gave the database name as SALES1...what is the problem
> here'
> Appreciate your help
> Thanks in advance!
>|||This is a multi-part message in MIME format.
--=_NextPart_000_07DC_01C7121B.7A817570
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Good formatting often makes things so easy to see. Notes inline...
CREATE DATABASE Sales1
ON PRIMARY
( NAME=3DSalesPrimary,
FILENAME=3D'D:\Temp\SalesPrimary.mdf',
SIZE =3D 500MB,
MAXSIZE =3D 500, --Maxsize has to be at least the same as Size
FILEGROWTH =3D 20
),
FILEGROUP SalesFG
( NAME =3D SalesData1,
FILENAME =3D 'D:\Temp\SalesData1.ndf',
SIZE =3D 200MB,
MAXSIZE =3D 800,
FILEGROWTH =3D 100
),
( , --Missing Filename here
FILENAME=3D'D:\Temp\SalesData2.ndf',
SIZE =3D 400MB,
MAXSIZE =3D 1200,
FILEGROWTH =3D 300
),
FILEGROUP SalesHistoryFG
( NAME =3D SalesHistory1,
FILENAME=3D'D:\Temp\SalesHistory1.ndf',
SIZE=3D100MB,
MAXSIZE=3D500,
FILEGROWTH=3D50
)
LOG ON
( NAME=3DArchlog1,
FILENAME=3D'D:\Temp\SalesLog.ldf',
SIZE=3D300MB,
MAXSIZE=3D800,
FILEGROWTH=3D100
)
-- Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous
You can't help someone get up a hill without getting a little closer to =the top yourself.
- H. Norman Schwarzkopf
"freeblue11" <freeblue11@.gmail.com> wrote in message =news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com...
>I am trying to execute these set of statements...
> > CREATE DATABASE Sales1
> ON
> PRIMARY(NAME=3DSalesPrimary,
> FILENAME=3D'C:\Kim\SalesPrimary.mdf',
> SIZE =3D 500MB,
> MAXSIZE =3D 200,
> FILEGROWTH =3D 20),
> FILEGROUP SalesFG
> (NAME =3D SalesData1,
> FILENAME =3D 'C:\Kim\SalesData1.ndf',
> SIZE =3D 200MB,
> MAXSIZE =3D 800,
> FILEGROWTH =3D 100),
> (FILENAME=3D'C:\Kim\SalesData2.ndf',
> SIZE =3D 400MB,
> MAXSIZE =3D 1200,
> FILEGROWTH =3D 300),
> FILEGROUP SalesHistoryFG
> (NAME =3D SalesHistory1,
> FILENAME=3D'C:\Kim\SalesHistory1.ndf',
> SIZE=3D100MB,
> MAXSIZE=3D500,
> FILEGROWTH=3D50)
> LOG ON
> (NAME=3DArchlog1,
> FILENAME=3D'C:\Kim\SalesLog.ldf',
> SIZE=3D300MB,
> MAXSIZE=3D800,
> FILEGROWTH=3D100)
> > I am using SSMS and typind this in the New Query Editor window.
> But when I execute it...it gives me an error saying...
> > Msg 1036, Level 16, State 2, Line 1
> File option NAME is required in this CREATE/ALTER DATABASE statement.
> But I already gave the database name as SALES1...what is the problem
> here'
> > Appreciate your help
> > Thanks in advance!
>
--=_NextPart_000_07DC_01C7121B.7A817570
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Good formatting often makes things so =easy to see. Notes inline...
CREATE DATABASE =Sales1 ON PRIMARY ( NAME=3DSalesPrimary, =FILENAME=3D'D:\Temp\SalesPrimary.mdf', &=nbsp; SIZE =3D 500MB, =MAXSIZE =3D 500, --Maxsize has to be at least the same as Size FILEGROWTH =3D 20 ), FILEGROUP SalesFG ( NAME =3D SalesData1, FILENAME ==3D 'D:\Temp\SalesData1.ndf', &n=bsp; SIZE =3D 200MB, =MAXSIZE =3D 800, FILEGROWTH =3D 100 =), ( , --Missing Filename here FILENAME=3D'D:\Temp\SalesData2.ndf', &nb=sp; SIZE =3D 400MB, =MAXSIZE =3D 1200, FILEGROWTH =3D =300 ), FILEGROUP SalesHistoryFG ( NAME =3D SalesHistory1, FILENAME=3D'D:\Temp\SalesHistory1.ndf', = SIZE=3D100MB, MAXSIZE=3D500, FILEGROWTH=3D50 ) LOG ON ( NAME=3DArchlog1, FILENAME=3D'D:\Temp\SalesLog.ldf',  =; SIZE=3D300MB, MAXSIZE=3D800, FILEGROWTH=3D100 )
-- Arnie Rowland, =Ph.D.Westwood Consulting, Inc
Most good judgment comes from =experience. Most experience comes from bad judgment. - Anonymous
You can't help someone get up a hill =without getting a little closer to the top yourself.- H. Norman Schwarzkopf
"freeblue11" =wrote in message news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com=...>I =am trying to execute these set of statements...> > CREATE DATABASE Sales1> ON> PRIMARY(NAME=3DSalesPrimary,> FILENAME=3D'C:\Kim\SalesPrimary.mdf',> SIZE =3D 500MB,> =MAXSIZE =3D 200,> FILEGROWTH =3D 20),> FILEGROUP SalesFG> (NAME ==3D SalesData1,> FILENAME =3D 'C:\Kim\SalesData1.ndf',> SIZE ==3D 200MB,> MAXSIZE =3D 800,> FILEGROWTH =3D 100),> (FILENAME=3D'C:\Kim\SalesData2.ndf',> SIZE =3D 400MB,> =MAXSIZE =3D 1200,> FILEGROWTH =3D 300),> FILEGROUP =SalesHistoryFG> (NAME =3D SalesHistory1,> =FILENAME=3D'C:\Kim\SalesHistory1.ndf',> SIZE=3D100MB,> MAXSIZE=3D500,> FILEGROWTH=3D50)> =LOG ON> (NAME=3DArchlog1,> FILENAME=3D'C:\Kim\SalesLog.ldf',> SIZE=3D300MB,> MAXSIZE=3D800,> FILEGROWTH=3D100)> => I am using SSMS and typind this in the New Query Editor window.> But =when I execute it...it gives me an error saying...> > Msg 1036, =Level 16, State 2, Line 1> File option NAME is required in this =CREATE/ALTER DATABASE statement.> But I already gave the database name as SALES1...what is the problem> here'> > =Appreciate your help> > Thanks in advance!>

--=_NextPart_000_07DC_01C7121B.7A817570--|||Kevin, Arnie
My oversite!!
Thank you very much!
Arnie Rowland wrote:
> Good formatting often makes things so easy to see. Notes inline...
> CREATE DATABASE Sales1
> ON PRIMARY
> ( NAME=SalesPrimary,
> FILENAME='D:\Temp\SalesPrimary.mdf',
> SIZE = 500MB,
> MAXSIZE = 500, --Maxsize has to be at least the same as Size
> FILEGROWTH = 20
> ),
> FILEGROUP SalesFG
> ( NAME = SalesData1,
> FILENAME = 'D:\Temp\SalesData1.ndf',
> SIZE = 200MB,
> MAXSIZE = 800,
> FILEGROWTH = 100
> ),
> ( , --Missing Filename here
> FILENAME='D:\Temp\SalesData2.ndf',
> SIZE = 400MB,
> MAXSIZE = 1200,
> FILEGROWTH = 300
> ),
> FILEGROUP SalesHistoryFG
> ( NAME = SalesHistory1,
> FILENAME='D:\Temp\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50
> )
> LOG ON
> ( NAME=Archlog1,
> FILENAME='D:\Temp\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100
> )
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
> You can't help someone get up a hill without getting a little closer to the top yourself.
> - H. Norman Schwarzkopf
>
> "freeblue11" <freeblue11@.gmail.com> wrote in message news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com...
> >I am trying to execute these set of statements...
> >
> > CREATE DATABASE Sales1
> > ON
> > PRIMARY(NAME=SalesPrimary,
> > FILENAME='C:\Kim\SalesPrimary.mdf',
> > SIZE = 500MB,
> > MAXSIZE = 200,
> > FILEGROWTH = 20),
> > FILEGROUP SalesFG
> > (NAME = SalesData1,
> > FILENAME = 'C:\Kim\SalesData1.ndf',
> > SIZE = 200MB,
> > MAXSIZE = 800,
> > FILEGROWTH = 100),
> > (FILENAME='C:\Kim\SalesData2.ndf',
> > SIZE = 400MB,
> > MAXSIZE = 1200,
> > FILEGROWTH = 300),
> > FILEGROUP SalesHistoryFG
> > (NAME = SalesHistory1,
> > FILENAME='C:\Kim\SalesHistory1.ndf',
> > SIZE=100MB,
> > MAXSIZE=500,
> > FILEGROWTH=50)
> > LOG ON
> > (NAME=Archlog1,
> > FILENAME='C:\Kim\SalesLog.ldf',
> > SIZE=300MB,
> > MAXSIZE=800,
> > FILEGROWTH=100)
> >
> > I am using SSMS and typind this in the New Query Editor window.
> > But when I execute it...it gives me an error saying...
> >
> > Msg 1036, Level 16, State 2, Line 1
> > File option NAME is required in this CREATE/ALTER DATABASE statement.
> > But I already gave the database name as SALES1...what is the problem
> > here'
> >
> > Appreciate your help
> >
> > Thanks in advance!
> >
> --=_NextPart_000_07DC_01C7121B.7A817570
> Content-Type: text/html; charset=iso-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 5412
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> &

>
>
>
>
>
> Good formatting often makes things so easy to see.
> Notes inline...
>
> CREATE DATABASE Sales1 ON
> PRIMARY (
> NAME=SalesPrimary,
> FILENAME='D:\Temp\SalesPrimary.mdf',
> SIZE = 500MB, MAXSIZE => 500, --Maxsize has to be at least the same as
> Size FILEGROWTH => 20 ), FILEGROUP
> SalesFG ( NAME => SalesData1, FILENAME => 'D:\Temp\SalesData1.ndf',
> SIZE = 200MB, MAXSIZE => 800, FILEGROWTH => 100 ),
> ( , --Missing Filename
> here
> FILENAME='D:\Temp\SalesData2.ndf',
> SIZE = 400MB, MAXSIZE => 1200, FILEGROWTH => 300 ), FILEGROUP
> SalesHistoryFG ( NAME => SalesHistory1,
> FILENAME='D:\Temp\SalesHistory1.ndf',
> SIZE=100MB,
> MAXSIZE=500,
> FILEGROWTH=50 ) LOG
> ON (
> NAME=Archlog1,
> FILENAME='D:\Temp\SalesLog.ldf',
> SIZE=300MB,
> MAXSIZE=800,
> FILEGROWTH=100 )
>
> -- Arnie Rowland, Ph.D.Westwood
> Consulting, Inc
>
> Most good judgment comes from experience. Most
> experience comes from bad judgment. - Anonymous
>
> You can't help someone get up a hill without
> getting a little closer to the top yourself.- H. Norman
> Schwarzkopf
>
>
> "freeblue11" < href="http://links.10026.com/?link=mailto:freeblue11@.gmail.com"> size=2>freeblue11@.gmail.com> wrote in
> message href="http://links.10026.com/?link=news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com"> face=Arial
> size=2>news:1164656369.028134.98250@.j72g2000cwa.googlegroups.com face=Arial size=2>...>I am trying to
> execute these set of statements...> > CREATE DATABASE
> Sales1> ON> PRIMARY(NAME=SalesPrimary,>
> FILENAME='C:\Kim\SalesPrimary.mdf',> SIZE = 500MB,> MAXSIZE => 200,> FILEGROWTH = 20),> FILEGROUP SalesFG> (NAME => SalesData1,> FILENAME = 'C:\Kim\SalesData1.ndf',> SIZE => 200MB,> MAXSIZE = 800,> FILEGROWTH = 100),>
> (FILENAME='C:\Kim\SalesData2.ndf',> SIZE = 400MB,> MAXSIZE => 1200,> FILEGROWTH = 300),> FILEGROUP SalesHistoryFG> (NAME
> = SalesHistory1,> FILENAME='C:\Kim\SalesHistory1.ndf',>
> SIZE=100MB,> MAXSIZE=500,> FILEGROWTH=50)> LOG ON>
> (NAME=Archlog1,> FILENAME='C:\Kim\SalesLog.ldf',>
> SIZE=300MB,> MAXSIZE=800,> FILEGROWTH=100)> > I am
> using SSMS and typind this in the New Query Editor window.> But when I
> execute it...it gives me an error saying...> > Msg 1036, Level 16,
> State 2, Line 1> File option NAME is required in this CREATE/ALTER
> DATABASE statement.> But I already gave the database name as
> SALES1...what is the problem> here'> > Appreciate your
> help> > Thanks in advance!>

> --=_NextPart_000_07DC_01C7121B.7A817570--

Newb with a serious Trigger question.

Ok I am stumped. I am a newbie in terms of triggers and procedures and am
used to writing inline sql statements , so here is my situation.
I have an audit table for all the updates , inserts and deletes throughout
one of my application database(SQL2005).
Whenever something happens a record gets inserted into this table(this was
all accomplished by an external dll coded somewhere else that i found on the
internet - and all this works fantastically.)
The problem i have is that after the insert into the audit table occurs, i
want to be able to do this...
have a second trigger for the insert on the audit table
this will go out using the Primary key of the edited table (eg. tasks) and
the table name (eg tasks_) and operation type (eg UPDATE< INSERT whatever)
and get these values that are now in the new audit table record.
then i want to use these values to dynamically select a created_By field
from say the tasks table and update the audit record with this new
created_By field.
the theory is that the dll works but puts dbo in for the user all the time,
so i want to go into the application side and grab the user who entered the
info and update the audit trail records.
Is this clear and concise or am i mumbling?
Any help would be vastly appreciated.
Thanks in advance,
COlinColin Smart (csmart@.nf.sympatico.ca) writes:
> I have an audit table for all the updates , inserts and deletes throughout
> one of my application database(SQL2005).
> Whenever something happens a record gets inserted into this table(this was
> all accomplished by an external dll coded somewhere else that i found on
> the internet - and all this works fantastically.)
> The problem i have is that after the insert into the audit table occurs, i
> want to be able to do this...
> have a second trigger for the insert on the audit table this will go out
> using the Primary key of the edited table (eg. tasks) and the table name
> (eg tasks_) and operation type (eg UPDATE< INSERT whatever) and get
> these values that are now in the new audit table record.
> then i want to use these values to dynamically select a created_By field
> from say the tasks table and update the audit record with this new
> created_By field.
> the theory is that the dll works but puts dbo in for the user all the
> time, so i want to go into the application side and grab the user who
> entered the info and update the audit trail records.
From exactly where is this DLL invoked?
This sounds like a solution for SQL 2000 or earlier. That trigger
would be messy to code. It sounds as if the DLL runs as dbo, in
which case you could use dynamic SQL. But if any of the tables does
not have a Created_by column, it will bloe up at run-time. A better
solution would be to pass the DLL the value of original_login() somehow.
(On SQL 2005 you should use original_login(), rather than SYSTEM_USER.)
On SQL 2005, the xml column can be very good for auditing. It depends
exactly what you will use the audit data for, but if you are not going
to run any searches on other data than the table name and key values,
you can use an xml column. The nice thing is that you can do a
SELECT ... FROM inserted FOR XML, and the triggers can be quite generic.
Even nicer is that you can make an entire generic program that reads
the log table, and presents the differences between two log records.
If you insert directly into the auditlog, there is not any problem of
retrieving the current user.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx