Showing posts with label execute. Show all posts
Showing posts with label execute. Show all posts

Friday, March 30, 2012

Increase Timeout ?

I am using VB.net to execute a stored procedure... Sometimes I get a
timeout, other times I do not. How can I increase the time out ? Is
this a server setting ?Can;t help you on the timeout...but would it makes sense to look at the
performance of your procedure?
How long is the VB.net timeout currently?
--
Kevin Hill
IC3 North Texas
www.ChristianCycling.com
Please support me in the 2008 MS150:
http://www.ms150.org/dallas/donate/donate.cfm?id=208000
"Rob" <robc1@.yahoo.com> wrote in message
news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com...
>I am using VB.net to execute a stored procedure... Sometimes I get a
>timeout, other times I do not. How can I increase the time out ? Is
>this a server setting ?
>|||That doesn't really sound like a "fix" to me at all. You can increase the
timeout to infinity, but users are still going to get bored at some point.
Have you considered looking at the stored procedure itself, and making it
faster, instead of trying to find ways to make its slowness more acceptable?
"Rob" <robc1@.yahoo.com> wrote in message
news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com...
>I am using VB.net to execute a stored procedure... Sometimes I get a
>timeout, other times I do not. How can I increase the time out ? Is
>this a server setting ?
>|||Hi,
The stored procedure is very straightforward. I am currently using an under
powered test server. I never get the timeout on the production server...
So how do I increase the timeout ?
Thanks
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uOunlH$TIHA.4440@.TK2MSFTNGP06.phx.gbl...
> That doesn't really sound like a "fix" to me at all. You can increase the
> timeout to infinity, but users are still going to get bored at some point.
> Have you considered looking at the stored procedure itself, and making it
> faster, instead of trying to find ways to make its slowness more
> acceptable?
>
>
> "Rob" <robc1@.yahoo.com> wrote in message
> news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com...
>>I am using VB.net to execute a stored procedure... Sometimes I get a
>>timeout, other times I do not. How can I increase the time out ? Is
>>this a server setting ?
>|||Rob
In VB sourcer when you connect to the server there's method called
CommandTimeout
Set Acn = New ADODB.Connection
Acn.CommandTimeout = 0
"Rob" <robc1@.yahoo.com> wrote in message
news:Y6WdnRf7neuvgh3anZ2dnUVZ_s6mnZ2d@.comcast.com...
> Hi,
> The stored procedure is very straightforward. I am currently using an
> under powered test server. I never get the timeout on the production
> server...
> So how do I increase the timeout ?
> Thanks
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:uOunlH$TIHA.4440@.TK2MSFTNGP06.phx.gbl...
>> That doesn't really sound like a "fix" to me at all. You can increase
>> the timeout to infinity, but users are still going to get bored at some
>> point. Have you considered looking at the stored procedure itself, and
>> making it faster, instead of trying to find ways to make its slowness
>> more acceptable?
>>
>>
>> "Rob" <robc1@.yahoo.com> wrote in message
>> news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com...
>>I am using VB.net to execute a stored procedure... Sometimes I get a
>>timeout, other times I do not. How can I increase the time out ? Is
>>this a server setting ?
>>
>|||The default ADO.NET timeout is 30 seconds. This can be changed with the
SqlCommand object CommandTimeout property. For example:
myCommand.CommandTimeout = 60
However, I agree with the others that the timeout should be changed only
after ensuring proper index and query tuning is done. It could be that the
production server simply has enough power to compensate for inefficiencies.
Developing on an underpowered server can provide the motivation to improve
performance ;-)
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Rob" <robc1@.yahoo.com> wrote in message
news:Y6WdnRf7neuvgh3anZ2dnUVZ_s6mnZ2d@.comcast.com...
> Hi,
> The stored procedure is very straightforward. I am currently using an
> under powered test server. I never get the timeout on the production
> server...
> So how do I increase the timeout ?
> Thanks
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:uOunlH$TIHA.4440@.TK2MSFTNGP06.phx.gbl...
>> That doesn't really sound like a "fix" to me at all. You can increase
>> the timeout to infinity, but users are still going to get bored at some
>> point. Have you considered looking at the stored procedure itself, and
>> making it faster, instead of trying to find ways to make its slowness
>> more acceptable?
>>
>>
>> "Rob" <robc1@.yahoo.com> wrote in message
>> news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com...
>>I am using VB.net to execute a stored procedure... Sometimes I get a
>>timeout, other times I do not. How can I increase the time out ? Is
>>this a server setting ?
>>
>|||"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:701FF8B7-52A8-4431-98EB-D4F2E5F1C20F@.microsoft.com...
> The default ADO.NET timeout is 30 seconds. This can be changed with the
> SqlCommand object CommandTimeout property. For example:
> myCommand.CommandTimeout = 60
> However, I agree with the others that the timeout should be changed only
> after ensuring proper index and query tuning is done. It could be that
> the production server simply has enough power to compensate for
> inefficiencies. Developing on an underpowered server can provide the
> motivation to improve performance ;-)
I just had to learn this one where I am. A query that basically returns the
DB as an XML feed (don't ask) now takes longer than 30 seconds. And even if
we improve it again, it's just going to get worse, again. Arrgh...
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
>
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Thanks !
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:701FF8B7-52A8-4431-98EB-D4F2E5F1C20F@.microsoft.com...
> The default ADO.NET timeout is 30 seconds. This can be changed with the
> SqlCommand object CommandTimeout property. For example:
> myCommand.CommandTimeout = 60
> However, I agree with the others that the timeout should be changed only
> after ensuring proper index and query tuning is done. It could be that
> the production server simply has enough power to compensate for
> inefficiencies. Developing on an underpowered server can provide the
> motivation to improve performance ;-)
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Rob" <robc1@.yahoo.com> wrote in message
> news:Y6WdnRf7neuvgh3anZ2dnUVZ_s6mnZ2d@.comcast.com...
>> Hi,
>> The stored procedure is very straightforward. I am currently using an
>> under powered test server. I never get the timeout on the production
>> server...
>> So how do I increase the timeout ?
>> Thanks
>> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
>> message news:uOunlH$TIHA.4440@.TK2MSFTNGP06.phx.gbl...
>> That doesn't really sound like a "fix" to me at all. You can increase
>> the timeout to infinity, but users are still going to get bored at some
>> point. Have you considered looking at the stored procedure itself, and
>> making it faster, instead of trying to find ways to make its slowness
>> more acceptable?
>>
>>
>> "Rob" <robc1@.yahoo.com> wrote in message
>> news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com...
>>I am using VB.net to execute a stored procedure... Sometimes I get a
>>timeout, other times I do not. How can I increase the time out ? Is
>>this a server setting ?
>>
>>
>sql

Increase Timeout ?

I am using VB.net to execute a stored procedure... Sometimes I get a
timeout, other times I do not. How can I increase the time out ? Is
this a server setting ?
Can;t help you on the timeout...but would it makes sense to look at the
performance of your procedure?
How long is the VB.net timeout currently?
Kevin Hill
IC3 North Texas
www.ChristianCycling.com
Please support me in the 2008 MS150:
http://www.ms150.org/dallas/donate/donate.cfm?id=208000
"Rob" <robc1@.yahoo.com> wrote in message
news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com. ..
>I am using VB.net to execute a stored procedure... Sometimes I get a
>timeout, other times I do not. How can I increase the time out ? Is
>this a server setting ?
>
|||That doesn't really sound like a "fix" to me at all. You can increase the
timeout to infinity, but users are still going to get bored at some point.
Have you considered looking at the stored procedure itself, and making it
faster, instead of trying to find ways to make its slowness more acceptable?
"Rob" <robc1@.yahoo.com> wrote in message
news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com. ..
>I am using VB.net to execute a stored procedure... Sometimes I get a
>timeout, other times I do not. How can I increase the time out ? Is
>this a server setting ?
>
|||Hi,
The stored procedure is very straightforward. I am currently using an under
powered test server. I never get the timeout on the production server...
So how do I increase the timeout ?
Thanks
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uOunlH$TIHA.4440@.TK2MSFTNGP06.phx.gbl...
> That doesn't really sound like a "fix" to me at all. You can increase the
> timeout to infinity, but users are still going to get bored at some point.
> Have you considered looking at the stored procedure itself, and making it
> faster, instead of trying to find ways to make its slowness more
> acceptable?
>
>
> "Rob" <robc1@.yahoo.com> wrote in message
> news:dZGdnVKfG_9Qlx3anZ2dnUVZ_s2tnZ2d@.comcast.com. ..
>
|||Rob
In VB sourcer when you connect to the server there's method called
CommandTimeout
Set Acn = New ADODB.Connection
Acn.CommandTimeout = 0
"Rob" <robc1@.yahoo.com> wrote in message
news:Y6WdnRf7neuvgh3anZ2dnUVZ_s6mnZ2d@.comcast.com. ..
> Hi,
> The stored procedure is very straightforward. I am currently using an
> under powered test server. I never get the timeout on the production
> server...
> So how do I increase the timeout ?
> Thanks
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:uOunlH$TIHA.4440@.TK2MSFTNGP06.phx.gbl...
>
|||The default ADO.NET timeout is 30 seconds. This can be changed with the
SqlCommand object CommandTimeout property. For example:
myCommand.CommandTimeout = 60
However, I agree with the others that the timeout should be changed only
after ensuring proper index and query tuning is done. It could be that the
production server simply has enough power to compensate for inefficiencies.
Developing on an underpowered server can provide the motivation to improve
performance ;-)
Hope this helps.
Dan Guzman
SQL Server MVP
"Rob" <robc1@.yahoo.com> wrote in message
news:Y6WdnRf7neuvgh3anZ2dnUVZ_s6mnZ2d@.comcast.com. ..
> Hi,
> The stored procedure is very straightforward. I am currently using an
> under powered test server. I never get the timeout on the production
> server...
> So how do I increase the timeout ?
> Thanks
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:uOunlH$TIHA.4440@.TK2MSFTNGP06.phx.gbl...
>
|||"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:701FF8B7-52A8-4431-98EB-D4F2E5F1C20F@.microsoft.com...
> The default ADO.NET timeout is 30 seconds. This can be changed with the
> SqlCommand object CommandTimeout property. For example:
> myCommand.CommandTimeout = 60
> However, I agree with the others that the timeout should be changed only
> after ensuring proper index and query tuning is done. It could be that
> the production server simply has enough power to compensate for
> inefficiencies. Developing on an underpowered server can provide the
> motivation to improve performance ;-)
I just had to learn this one where I am. A query that basically returns the
DB as an XML feed (don't ask) now takes longer than 30 seconds. And even if
we improve it again, it's just going to get worse, again. Arrgh...

> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
|||Thanks !
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:701FF8B7-52A8-4431-98EB-D4F2E5F1C20F@.microsoft.com...
> The default ADO.NET timeout is 30 seconds. This can be changed with the
> SqlCommand object CommandTimeout property. For example:
> myCommand.CommandTimeout = 60
> However, I agree with the others that the timeout should be changed only
> after ensuring proper index and query tuning is done. It could be that
> the production server simply has enough power to compensate for
> inefficiencies. Developing on an underpowered server can provide the
> motivation to improve performance ;-)
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Rob" <robc1@.yahoo.com> wrote in message
> news:Y6WdnRf7neuvgh3anZ2dnUVZ_s6mnZ2d@.comcast.com. ..
>

Monday, March 26, 2012

incorrect syntax near LEFT

this is the query im trying to execute in sql server.please let me know what is the error in this

SELECT "PROJECT"."PROJ_NAM", ' ' as dev_name, "PROJECT_FUND"."F_FUND_ID" as fund_id, view_on_watch_list.on_date
FROM LEFT OUTER JOIN view_on_watch_list ON project.proj_id =view_on_watch_list.proj_id , "PROJECT_FUND" LEFT OUTER JOIN "FUND" ON "PROJECT_FUND"."F_FUND_ID" = "FUND"."FUND_ID" AND project.proj_id = project_fund.f_proj_id , "PROJECT" WHERE (("PROJECT"."PROJ_ID" = 1))
select "PROJECT"."PROJ_ID", ' ' AS DEV_TYPE from PROJECTFROM LEFT OUTER JOIN
Enter Table_Name after "FROM" clause...

project.proj_id = project_fund.f_proj_id , "PROJECT" WHERE (("PROJECT"."PROJ_ID" = @.proj_id))
select "PROJECT"."PROJ_ID", ' ' AS DEV_TYPE from PROJECT
I didn't get what you want to do... Post your table structure, data & your requirement.|||actually im a beginner in MSSQL.im not aware of this LEFT OUTER JOIN syntax.
i tried with placing table name after 'LEFT' ,below error was thrown

[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Tables or functions 'project' and 'PROJECT' have the same exposed names. Use correlation names to distinguish them.|||Wel Come :)

Before you use query in application code, run & check it using SQL Query Analyzer.

Develop query step by step i.e. don't write entire query at once but create 1st then 2nd phrase etc...

Spend some time to learn, you can refer SELECT syntax in Books OnLine from SQL Query Analyzer.|||Hi

If you are just starting you might find this a gentler learning curve:
http://www.w3schools.com/sql/sql_intro.asp

rajeshpatel is spot on - don't write out loads at once - write a small section, run, if it works write some more else refer to the link and correct.

HTH|||thank u rajesh.im familiar with sql's(DDLS and DMLS).please guide me to the correct query for the above one.|||I'm afraid the SQL is so bad it is not possible to tell what you want you want to do. I strongly recommend you read the link and have another stab at writing it. As you come up against problems get back to us with specifics.

If you build up a bit at a time it might be possible to infer what you are actually attempting to do.

Friday, March 23, 2012

Incorrect syntax

Hi Im trying to build a database in Microsoft SQL Server 2005.
Ive written the code, but when I execute it, I keep getting an error
message (below)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'customer'.
Code below, any help would be great!
--Table structure for table 'customer'
CREATE TABLE 'customer'(
'CustID' int(10) NOT NULL AUTO_INCREMENT,
'CustName' char(50) NOT NULL,
'Address' char(50) NOT NULL,
PRIMARY KEY ('CustID')
)
--Dumping data for table 'customer'
INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
(3,'DailyMurkInc','Fleet Marina');
--Table Structure for table 'deliverynote'
CREATE TABLE 'deliverynote'(
'CATref' int(20) NOT NULL auto_increment,
'CustID' int(50) NOT NULL,
'EquipCat' char(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'EquipName' char(50) NOT NULL,
PRIMARY KEY ('CATref','CustID')
)
--Dumping data for table 'deliverynote'
INSERT INTO 'deliverynote' VALUES
('01235',2,'Domestic',1,'Fan'),('03278',3,'Domesti c',7,'Toothbrush'),('03452',2,'Domestic',2,'Fan'),
('04577',1,'Commercial',8,'Computer'),('07853',1,' Commercial',9,'Printer'),('08453',3,'Commercial',4 ,'Computer'),('08734',3,'Industrial',6,'Heater'),
('08897',1,'Commercial',10,'Fax'),('08924',3,'Dome stic',5,'Kettle'),('08992',3,'Commercial',3,'Monit or');
--Table Structure for table 'engineer'
CREATE TABLE 'engineer'(
'EngineerName' char(50) NOT NULL,
PRIMARY KEY ('EngineerName')
}
--Dumping data for table 'engineer'
INSERT INTO 'engineer' VALUES ('Botchit'),('Fudgeit'),('Perfect');
--Table Structure for table 'equipmentcat'
CREATE TABLE 'equipmentcat' (
'EquipCat' char(50) NOT NULL,
PRIMARY KEY ('EquipCat')
)
--Dumping data for table 'equipmentcat'
INSERT INTO 'equipmentcat' VALUES
('Commercial'),('Domestic'),('Industrial');
--Table Structure for table 'repairer'
CREATE TABLE 'repairer' (
'RepID' int(10) NOT NULL,
'RepName' char(50) NOT NULL,
PRIMARY KEY ('RepID')
)
--Dumping data for table 'repairer'
INSERT INTO 'repairer' VALUES (1, 'Mr Green'),(2,'Mrs Brown'),(3,'Mr
White');
--Table Structure for table 'locationid'
CREATE TABLE 'locationid' (
'LocationName' char(50) NOT NULL,
PRIMARY KEY ('LocationName')
)
--Dumping data for table 'locationid'
INSERT INTO 'locationid' VALUES
('Despatch'),('Gone_Home'),('Goods_In'),('Repairer '),('Testing');
--Table Structure for table 'location'
CREATE TABLE 'location' (
'EquipNumber' int(20) NOT NULL,
'CATref' int(20) NOT NULL,
'Testing' char(50) NOT NULL,
'Despatchdate' char(50) NOT NULL,
PRIMARY KEY ('CATref')
FOREIGN KEY ('CATref')
)
--Dumping data for table 'location'
INSERT INTO 'location' VALUES (1,'01235','April 5th 1999, Aprl 13th
1999','April 14th 1999'),(10,'08997','May 3rd 1999','May 5th 1999'),
(2,'03452','April 5th 1999','April 6th 1999'),(3,'08992','April 12th
1999','April 13th 1999'),(4,'08453','April 12th 1999','April 14th
1999'),
(5,'08924','April 12th 1999, April 17th 1999','April 20th
1999'),(6,'08734','April 13th 1999','April 14th
1999'),(7,'03278','April 13th 1999, April 17th 1999','April 19th
1999'),
(8,'04577','May 3rd 1999','May 5th 1999'), (9,'07853','May 3rd
1999','May 5th 1999');
--Table Structure for table 'testrecord'
CREATE TABLE 'testrecord' (
'CATref' int(20) NOT NULL,
'CustID' int(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'Date' char(50) NOT NULL,
'EngineerName' char(50) NOT NULL,
'Pass/Fail' char(20) NOT NULL,
PRIMARY KEY ('CATref','CustID')
FOREIGN KEY ('CATref','CustID','EngineerName')
)
--Dumping data for table 'testrecord'
INSERT INTO 'testrecord' VALUES ('01235',2,1,'Fan','April 6th
1999','Botchit','Pass'),('012357',2,1,'Fan','May 2nd
2000','Fudgeit','Fail'),('03278',3,7,'Toothbrush', 'April 13th
1999','Perfect','Pass')
,('08453',3,4,'Computer','April 12th
1999','Botchit','Pass'),('084531',3,4,'Computer',' May 6th
2000','Perfect','Pass'),('084532',3,4,'Computer',' May 9th
2000','Botchit','Pass'),('08734',3,6,'Heater','Apr il 13th
1999','Botchit','Pass'),
('08924',3,5,'Kettle','April 12th
1999','Perfect','Fail'),('089248',3,5,'Kettle','Ma y 6th
2000','Fudgeit','Pass'),('08992',3,3,'Monitor','Ap ril 12th
1999','Fudgeit','Pass'),('089921',3,3,'Monitor','M ay 6th
2000','Perfect','Pass');
--Table Structure for table 'equipment'
CREATE TABLE 'equipment' (
'CATref' int(20) NOT NULL,
'CustID' int(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'EquipCat' char(50) NOT NULL,
'EquipName' char(50) NOT NULL,
'Goods_In_Date' char(50) NOT NULL,
'Repairer_Date' char (50) NOT NULL,
'Despatch_Date' char(50) NOT NULL,
'Home_Date' char(50) NOT NULL,
'RepID' int(10) NOT NULL,
PRIMARY KEY ('CATref', 'CustID')
FOREIGN KEU ('RepID','EqipCat','CATref','CustID')
)
--Dumping data for table 'equipment'
INSERT INTO 'equipment' VALUES
('01235',2,1,'Domestic','Fan','April 5th 1999','April 7th, 1, 'April
12th 1999','April 14th 1999',2),
('012357',2,1,'Domestic','Fan','May 1st 2000','May 3rd 2000','May 18th
2000','May 20th 2000',3),
('03278',3,7,'Domestic','Toothbrush','April 12th 1999','April 15th
1999','April 16th 1999','April 20th 1999',1),
('03452',2,2,'Domestic','Fan','April 5th 1999','April 14th
1999'),('04577',1,8,'Commercial','Computer','May 1st 1999','May 5th
1999'),
('07853',1,9,'Commercial','Printer','May 1st 1999','May 5th
1999'),('08453',3,4,'Commercial','Computer','April 12th 1999','April
15th 1999'),
('084531',3,4,'Commercial','Computer','May 5th 2000','May 6th
2000','May 8th 2000','May 10th
2000',1),('08734',3,6,'Industrial','Heater','April 12th 1999','April
15th 1999'),
('08892',3,3,'Commercial','Monitor','April 12th 1999','April 15th
1999'),('08897',1,10,'Commercial','Fax','May 1st 1999','May 5th
1999'),('08924',3,5,'Domestic','Kettle','April 12th 1999','April 13th
1999','April 17th 1999','April 20th 1999',2),
('089248',3,5,'Domestic','Kettle','May 5th 2000','May 10th
2000'),('089921',3,3,'Commercial','Monitor','May 5th 2000','May 10th
2000');
Daz
You have to specify INSERT INTO for each data to be insterted in your case
See if this helps
INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway Cuttings,
Euphoria')
INSERT INTO 'customer' VALUES (2,'Sinking.com','Virtual Lane, Peckham')
INSERT INTO 'customer' VALUES (3,'DailyMurkInc','Fleet Marina');
"Daz01" <dazzaf15@.hotmail.com> wrote in message
news:1166005705.720733.30310@.73g2000cwn.googlegrou ps.com...
> Hi Im trying to build a database in Microsoft SQL Server 2005.
> Ive written the code, but when I execute it, I keep getting an error
> message (below)
> Msg 102, Level 15, State 1, Line 1
> Incorrect syntax near 'customer'.
>
> Code below, any help would be great!
> --Table structure for table 'customer'
>
> CREATE TABLE 'customer'(
> 'CustID' int(10) NOT NULL AUTO_INCREMENT,
> 'CustName' char(50) NOT NULL,
> 'Address' char(50) NOT NULL,
> PRIMARY KEY ('CustID')
> )
> --Dumping data for table 'customer'
> INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
> Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
> (3,'DailyMurkInc','Fleet Marina');
>
> --Table Structure for table 'deliverynote'
>
> CREATE TABLE 'deliverynote'(
> 'CATref' int(20) NOT NULL auto_increment,
> 'CustID' int(50) NOT NULL,
> 'EquipCat' char(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'EquipName' char(50) NOT NULL,
> PRIMARY KEY ('CATref','CustID')
> )
> --Dumping data for table 'deliverynote'
> INSERT INTO 'deliverynote' VALUES
> ('01235',2,'Domestic',1,'Fan'),('03278',3,'Domesti c',7,'Toothbrush'),('03452',2,'Domestic',2,'Fan'),
> ('04577',1,'Commercial',8,'Computer'),('07853',1,' Commercial',9,'Printer'),('08453',3,'Commercial',4 ,'Computer'),('08734',3,'Industrial',6,'Heater'),
> ('08897',1,'Commercial',10,'Fax'),('08924',3,'Dome stic',5,'Kettle'),('08992',3,'Commercial',3,'Monit or');
>
> --Table Structure for table 'engineer'
> CREATE TABLE 'engineer'(
> 'EngineerName' char(50) NOT NULL,
> PRIMARY KEY ('EngineerName')
> }
> --Dumping data for table 'engineer'
> INSERT INTO 'engineer' VALUES ('Botchit'),('Fudgeit'),('Perfect');
>
> --Table Structure for table 'equipmentcat'
> CREATE TABLE 'equipmentcat' (
> 'EquipCat' char(50) NOT NULL,
> PRIMARY KEY ('EquipCat')
> )
> --Dumping data for table 'equipmentcat'
>
> INSERT INTO 'equipmentcat' VALUES
> ('Commercial'),('Domestic'),('Industrial');
>
> --Table Structure for table 'repairer'
> CREATE TABLE 'repairer' (
> 'RepID' int(10) NOT NULL,
> 'RepName' char(50) NOT NULL,
> PRIMARY KEY ('RepID')
> )
> --Dumping data for table 'repairer'
> INSERT INTO 'repairer' VALUES (1, 'Mr Green'),(2,'Mrs Brown'),(3,'Mr
> White');
>
> --Table Structure for table 'locationid'
> CREATE TABLE 'locationid' (
> 'LocationName' char(50) NOT NULL,
> PRIMARY KEY ('LocationName')
> )
> --Dumping data for table 'locationid'
>
> INSERT INTO 'locationid' VALUES
> ('Despatch'),('Gone_Home'),('Goods_In'),('Repairer '),('Testing');
>
> --Table Structure for table 'location'
> CREATE TABLE 'location' (
> 'EquipNumber' int(20) NOT NULL,
> 'CATref' int(20) NOT NULL,
> 'Testing' char(50) NOT NULL,
> 'Despatchdate' char(50) NOT NULL,
> PRIMARY KEY ('CATref')
> FOREIGN KEY ('CATref')
> )
> --Dumping data for table 'location'
>
> INSERT INTO 'location' VALUES (1,'01235','April 5th 1999, Aprl 13th
> 1999','April 14th 1999'),(10,'08997','May 3rd 1999','May 5th 1999'),
> (2,'03452','April 5th 1999','April 6th 1999'),(3,'08992','April 12th
> 1999','April 13th 1999'),(4,'08453','April 12th 1999','April 14th
> 1999'),
> (5,'08924','April 12th 1999, April 17th 1999','April 20th
> 1999'),(6,'08734','April 13th 1999','April 14th
> 1999'),(7,'03278','April 13th 1999, April 17th 1999','April 19th
> 1999'),
> (8,'04577','May 3rd 1999','May 5th 1999'), (9,'07853','May 3rd
> 1999','May 5th 1999');
>
> --Table Structure for table 'testrecord'
> CREATE TABLE 'testrecord' (
> 'CATref' int(20) NOT NULL,
> 'CustID' int(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'Date' char(50) NOT NULL,
> 'EngineerName' char(50) NOT NULL,
> 'Pass/Fail' char(20) NOT NULL,
> PRIMARY KEY ('CATref','CustID')
> FOREIGN KEY ('CATref','CustID','EngineerName')
> )
> --Dumping data for table 'testrecord'
> INSERT INTO 'testrecord' VALUES ('01235',2,1,'Fan','April 6th
> 1999','Botchit','Pass'),('012357',2,1,'Fan','May 2nd
> 2000','Fudgeit','Fail'),('03278',3,7,'Toothbrush', 'April 13th
> 1999','Perfect','Pass')
> ,('08453',3,4,'Computer','April 12th
> 1999','Botchit','Pass'),('084531',3,4,'Computer',' May 6th
> 2000','Perfect','Pass'),('084532',3,4,'Computer',' May 9th
> 2000','Botchit','Pass'),('08734',3,6,'Heater','Apr il 13th
> 1999','Botchit','Pass'),
> ('08924',3,5,'Kettle','April 12th
> 1999','Perfect','Fail'),('089248',3,5,'Kettle','Ma y 6th
> 2000','Fudgeit','Pass'),('08992',3,3,'Monitor','Ap ril 12th
> 1999','Fudgeit','Pass'),('089921',3,3,'Monitor','M ay 6th
> 2000','Perfect','Pass');
>
> --Table Structure for table 'equipment'
> CREATE TABLE 'equipment' (
> 'CATref' int(20) NOT NULL,
> 'CustID' int(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'EquipCat' char(50) NOT NULL,
> 'EquipName' char(50) NOT NULL,
> 'Goods_In_Date' char(50) NOT NULL,
> 'Repairer_Date' char (50) NOT NULL,
> 'Despatch_Date' char(50) NOT NULL,
> 'Home_Date' char(50) NOT NULL,
> 'RepID' int(10) NOT NULL,
> PRIMARY KEY ('CATref', 'CustID')
> FOREIGN KEU ('RepID','EqipCat','CATref','CustID')
> )
> --Dumping data for table 'equipment'
> INSERT INTO 'equipment' VALUES
> ('01235',2,1,'Domestic','Fan','April 5th 1999','April 7th, 1, 'April
> 12th 1999','April 14th 1999',2),
> ('012357',2,1,'Domestic','Fan','May 1st 2000','May 3rd 2000','May 18th
> 2000','May 20th 2000',3),
> ('03278',3,7,'Domestic','Toothbrush','April 12th 1999', 'April 15th
> 1999','April 16th 1999','April 20th 1999',1),
> ('03452',2,2,'Domestic','Fan','April 5th 1999','April 14th
> 1999'),('04577',1,8,'Commercial','Computer','May 1st 1999','May 5th
> 1999'),
> ('07853',1,9,'Commercial','Printer','May 1st 1999','May 5th
> 1999'),('08453',3,4,'Commercial','Computer','April 12th 1999','April
> 15th 1999'),
> ('084531',3,4,'Commercial','Computer','May 5th 2000','May 6th
> 2000','May 8th 2000','May 10th
> 2000',1),('08734',3,6,'Industrial','Heater','April 12th 1999','April
> 15th 1999'),
> ('08892',3,3,'Commercial','Monitor','April 12th 1999','April 15th
> 1999'),('08897',1,10,'Commercial','Fax','May 1st 1999','May 5th
> 1999'),('08924',3,5,'Domestic','Kettle','April 12th 1999','April 13th
> 1999','April 17th 1999','April 20th 1999',2),
> ('089248',3,5,'Domestic','Kettle','May 5th 2000','May 10th
> 2000'),('089921',3,3,'Commercial','Monitor','May 5th 2000','May 10th
> 2000');
>

Incorrect syntax

Hi Im trying to build a database in Microsoft SQL Server 2005.
Ive written the code, but when I execute it, I keep getting an error
message (below)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'customer'.
Code below, any help would be great!
--Table structure for table 'customer'
CREATE TABLE 'customer'(
'CustID' int(10) NOT NULL AUTO_INCREMENT,
'CustName' char(50) NOT NULL,
'Address' char(50) NOT NULL,
PRIMARY KEY ('CustID')
)
--Dumping data for table 'customer'
INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
(3,'DailyMurkInc','Fleet Marina');
--Table Structure for table 'deliverynote'
CREATE TABLE 'deliverynote'(
'CATref' int(20) NOT NULL auto_increment,
'CustID' int(50) NOT NULL,
'EquipCat' char(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'EquipName' char(50) NOT NULL,
PRIMARY KEY ('CATref','CustID')
)
--Dumping data for table 'deliverynote'
INSERT INTO 'deliverynote' VALUES
('01235',2,'Domestic',1,'Fan'),('03278',
3,'Domestic',7,'Toothbrush'),('03452
',2,'Domestic',2,'Fan'),
('04577',1,'Commercial',8,'Computer'),('
07853',1,'Commercial',9,'Printer'),(
'08453',3,'Commercial',4,'Computer'),('0
8734',3,'Industrial',6,'Heater'),
('08897',1,'Commercial',10,'Fax'),('0892
4',3,'Domestic',5,'Kettle'),('08992'
,3,'Commercial',3,'Monitor');
--Table Structure for table 'engineer'
CREATE TABLE 'engineer'(
'EngineerName' char(50) NOT NULL,
PRIMARY KEY ('EngineerName')
}
--Dumping data for table 'engineer'
INSERT INTO 'engineer' VALUES ('Botchit'),('Fudgeit'),('Perfect');
--Table Structure for table 'equipmentcat'
CREATE TABLE 'equipmentcat' (
'EquipCat' char(50) NOT NULL,
PRIMARY KEY ('EquipCat')
)
--Dumping data for table 'equipmentcat'
INSERT INTO 'equipmentcat' VALUES
('Commercial'),('Domestic'),('Industrial
');
--Table Structure for table 'repairer'
CREATE TABLE 'repairer' (
'RepID' int(10) NOT NULL,
'RepName' char(50) NOT NULL,
PRIMARY KEY ('RepID')
)
--Dumping data for table 'repairer'
INSERT INTO 'repairer' VALUES (1, 'Mr Green'),(2,'Mrs Brown'),(3,'Mr
White');
--Table Structure for table 'locationid'
CREATE TABLE 'locationid' (
'LocationName' char(50) NOT NULL,
PRIMARY KEY ('LocationName')
)
--Dumping data for table 'locationid'
INSERT INTO 'locationid' VALUES
('Despatch'),('Gone_Home'),('Goods_In'),
('Repairer'),('Testing');
--Table Structure for table 'location'
CREATE TABLE 'location' (
'EquipNumber' int(20) NOT NULL,
'CATref' int(20) NOT NULL,
'Testing' char(50) NOT NULL,
'Despatchdate' char(50) NOT NULL,
PRIMARY KEY ('CATref')
FOREIGN KEY ('CATref')
)
--Dumping data for table 'location'
INSERT INTO 'location' VALUES (1,'01235','April 5th 1999, Aprl 13th
1999','April 14th 1999'),(10,'08997','May 3rd 1999','May 5th 1999'),
(2,'03452','April 5th 1999','April 6th 1999'),(3,'08992','April 12th
1999','April 13th 1999'),(4,'08453','April 12th 1999','April 14th
1999'),
(5,'08924','April 12th 1999, April 17th 1999','April 20th
1999'),(6,'08734','April 13th 1999','April 14th
1999'),(7,'03278','April 13th 1999, April 17th 1999','April 19th
1999'),
(8,'04577','May 3rd 1999','May 5th 1999'), (9,'07853','May 3rd
1999','May 5th 1999');
--Table Structure for table 'testrecord'
CREATE TABLE 'testrecord' (
'CATref' int(20) NOT NULL,
'CustID' int(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'Date' char(50) NOT NULL,
'EngineerName' char(50) NOT NULL,
'Pass/Fail' char(20) NOT NULL,
PRIMARY KEY ('CATref','CustID')
FOREIGN KEY ('CATref','CustID','EngineerName')
)
--Dumping data for table 'testrecord'
INSERT INTO 'testrecord' VALUES ('01235',2,1,'Fan','April 6th
1999','Botchit','Pass'),('012357',2,1,'F
an','May 2nd
2000','Fudgeit','Fail'),('03278',3,7,'To
othbrush','April 13th
1999','Perfect','Pass')
,('08453',3,4,'Computer','April 12th
1999','Botchit','Pass'),('084531',3,4,'C
omputer','May 6th
2000','Perfect','Pass'),('084532',3,4,'C
omputer','May 9th
2000','Botchit','Pass'),('08734',3,6,'He
ater','April 13th
1999','Botchit','Pass'),
('08924',3,5,'Kettle','April 12th
1999','Perfect','Fail'),('089248',3,5,'K
ettle','May 6th
2000','Fudgeit','Pass'),('08992',3,3,'Mo
nitor','April 12th
1999','Fudgeit','Pass'),('089921',3,3,'M
onitor','May 6th
2000','Perfect','Pass');
--Table Structure for table 'equipment'
CREATE TABLE 'equipment' (
'CATref' int(20) NOT NULL,
'CustID' int(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'EquipCat' char(50) NOT NULL,
'EquipName' char(50) NOT NULL,
'Goods_In_Date' char(50) NOT NULL,
'Repairer_Date' char (50) NOT NULL,
'Despatch_Date' char(50) NOT NULL,
'Home_Date' char(50) NOT NULL,
'RepID' int(10) NOT NULL,
PRIMARY KEY ('CATref', 'CustID')
FOREIGN KEU ('RepID','EqipCat','CATref','CustID')
)
--Dumping data for table 'equipment'
INSERT INTO 'equipment' VALUES
('01235',2,1,'Domestic','Fan','April 5th 1999','April 7th, 1, 'April
12th 1999','April 14th 1999',2),
('012357',2,1,'Domestic','Fan','May 1st 2000','May 3rd 2000','May 18th
2000','May 20th 2000',3),
('03278',3,7,'Domestic','Toothbrush','Ap
ril 12th 1999', 'April 15th
1999','April 16th 1999','April 20th 1999',1),
('03452',2,2,'Domestic','Fan','April 5th 1999','April 14th
1999'),('04577',1,8,'Commercial','Comput
er','May 1st 1999','May 5th
1999'),
('07853',1,9,'Commercial','Printer','May
1st 1999','May 5th
1999'),('08453',3,4,'Commercial','Comput
er','April 12th 1999','April
15th 1999'),
('084531',3,4,'Commercial','Computer','M
ay 5th 2000','May 6th
2000','May 8th 2000','May 10th
2000',1),('08734',3,6,'Industrial','Heat
er','April 12th 1999','April
15th 1999'),
('08892',3,3,'Commercial','Monitor','Apr
il 12th 1999','April 15th
1999'),('08897',1,10,'Commercial','Fax',
'May 1st 1999','May 5th
1999'),('08924',3,5,'Domestic','Kettle',
'April 12th 1999','April 13th
1999','April 17th 1999','April 20th 1999',2),
('089248',3,5,'Domestic','Kettle','May 5th 2000','May 10th
2000'),('089921',3,3,'Commercial','Monit
or','May 5th 2000','May 10th
2000');Daz
You have to specify INSERT INTO for each data to be insterted in your case
See if this helps
INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway Cuttings,
Euphoria')
INSERT INTO 'customer' VALUES (2,'Sinking.com','Virtual Lane, Peckham')
INSERT INTO 'customer' VALUES (3,'DailyMurkInc','Fleet Marina');
"Daz01" <dazzaf15@.hotmail.com> wrote in message
news:1166005705.720733.30310@.73g2000cwn.googlegroups.com...
> Hi Im trying to build a database in Microsoft SQL Server 2005.
> Ive written the code, but when I execute it, I keep getting an error
> message (below)
> Msg 102, Level 15, State 1, Line 1
> Incorrect syntax near 'customer'.
>
> Code below, any help would be great!
> --Table structure for table 'customer'
>
> CREATE TABLE 'customer'(
> 'CustID' int(10) NOT NULL AUTO_INCREMENT,
> 'CustName' char(50) NOT NULL,
> 'Address' char(50) NOT NULL,
> PRIMARY KEY ('CustID')
> )
> --Dumping data for table 'customer'
> INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
> Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
> (3,'DailyMurkInc','Fleet Marina');
>
> --Table Structure for table 'deliverynote'
>
> CREATE TABLE 'deliverynote'(
> 'CATref' int(20) NOT NULL auto_increment,
> 'CustID' int(50) NOT NULL,
> 'EquipCat' char(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'EquipName' char(50) NOT NULL,
> PRIMARY KEY ('CATref','CustID')
> )
> --Dumping data for table 'deliverynote'
> INSERT INTO 'deliverynote' VALUES
> ('01235',2,'Domestic',1,'Fan'),('03278',
3,'Domestic',7,'Toothbrush'),('034
52',2,'Domestic',2,'Fan'),
> ('04577',1,'Commercial',8,'Computer'),('
07853',1,'Commercial',9,'Printer')
,('08453',3,'Commercial',4,'Computer'),(
'08734',3,'Industrial',6,'Heater'),
> ('08897',1,'Commercial',10,'Fax'),('0892
4',3,'Domestic',5,'Kettle'),('0899
2',3,'Commercial',3,'Monitor');
>
> --Table Structure for table 'engineer'
> CREATE TABLE 'engineer'(
> 'EngineerName' char(50) NOT NULL,
> PRIMARY KEY ('EngineerName')
> }
> --Dumping data for table 'engineer'
> INSERT INTO 'engineer' VALUES ('Botchit'),('Fudgeit'),('Perfect');
>
> --Table Structure for table 'equipmentcat'
> CREATE TABLE 'equipmentcat' (
> 'EquipCat' char(50) NOT NULL,
> PRIMARY KEY ('EquipCat')
> )
> --Dumping data for table 'equipmentcat'
>
> INSERT INTO 'equipmentcat' VALUES
> ('Commercial'),('Domestic'),('Industrial
');
>
> --Table Structure for table 'repairer'
> CREATE TABLE 'repairer' (
> 'RepID' int(10) NOT NULL,
> 'RepName' char(50) NOT NULL,
> PRIMARY KEY ('RepID')
> )
> --Dumping data for table 'repairer'
> INSERT INTO 'repairer' VALUES (1, 'Mr Green'),(2,'Mrs Brown'),(3,'Mr
> White');
>
> --Table Structure for table 'locationid'
> CREATE TABLE 'locationid' (
> 'LocationName' char(50) NOT NULL,
> PRIMARY KEY ('LocationName')
> )
> --Dumping data for table 'locationid'
>
> INSERT INTO 'locationid' VALUES
> ('Despatch'),('Gone_Home'),('Goods_In'),
('Repairer'),('Testing');
>
> --Table Structure for table 'location'
> CREATE TABLE 'location' (
> 'EquipNumber' int(20) NOT NULL,
> 'CATref' int(20) NOT NULL,
> 'Testing' char(50) NOT NULL,
> 'Despatchdate' char(50) NOT NULL,
> PRIMARY KEY ('CATref')
> FOREIGN KEY ('CATref')
> )
> --Dumping data for table 'location'
>
> INSERT INTO 'location' VALUES (1,'01235','April 5th 1999, Aprl 13th
> 1999','April 14th 1999'),(10,'08997','May 3rd 1999','May 5th 1999'),
> (2,'03452','April 5th 1999','April 6th 1999'),(3,'08992','April 12th
> 1999','April 13th 1999'),(4,'08453','April 12th 1999','April 14th
> 1999'),
> (5,'08924','April 12th 1999, April 17th 1999','April 20th
> 1999'),(6,'08734','April 13th 1999','April 14th
> 1999'),(7,'03278','April 13th 1999, April 17th 1999','April 19th
> 1999'),
> (8,'04577','May 3rd 1999','May 5th 1999'), (9,'07853','May 3rd
> 1999','May 5th 1999');
>
> --Table Structure for table 'testrecord'
> CREATE TABLE 'testrecord' (
> 'CATref' int(20) NOT NULL,
> 'CustID' int(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'Date' char(50) NOT NULL,
> 'EngineerName' char(50) NOT NULL,
> 'Pass/Fail' char(20) NOT NULL,
> PRIMARY KEY ('CATref','CustID')
> FOREIGN KEY ('CATref','CustID','EngineerName')
> )
> --Dumping data for table 'testrecord'
> INSERT INTO 'testrecord' VALUES ('01235',2,1,'Fan','April 6th
> 1999','Botchit','Pass'),('012357',2,1,'F
an','May 2nd
> 2000','Fudgeit','Fail'),('03278',3,7,'To
othbrush','April 13th
> 1999','Perfect','Pass')
> ,('08453',3,4,'Computer','April 12th
> 1999','Botchit','Pass'),('084531',3,4,'C
omputer','May 6th
> 2000','Perfect','Pass'),('084532',3,4,'C
omputer','May 9th
> 2000','Botchit','Pass'),('08734',3,6,'He
ater','April 13th
> 1999','Botchit','Pass'),
> ('08924',3,5,'Kettle','April 12th
> 1999','Perfect','Fail'),('089248',3,5,'K
ettle','May 6th
> 2000','Fudgeit','Pass'),('08992',3,3,'Mo
nitor','April 12th
> 1999','Fudgeit','Pass'),('089921',3,3,'M
onitor','May 6th
> 2000','Perfect','Pass');
>
> --Table Structure for table 'equipment'
> CREATE TABLE 'equipment' (
> 'CATref' int(20) NOT NULL,
> 'CustID' int(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'EquipCat' char(50) NOT NULL,
> 'EquipName' char(50) NOT NULL,
> 'Goods_In_Date' char(50) NOT NULL,
> 'Repairer_Date' char (50) NOT NULL,
> 'Despatch_Date' char(50) NOT NULL,
> 'Home_Date' char(50) NOT NULL,
> 'RepID' int(10) NOT NULL,
> PRIMARY KEY ('CATref', 'CustID')
> FOREIGN KEU ('RepID','EqipCat','CATref','CustID')
> )
> --Dumping data for table 'equipment'
> INSERT INTO 'equipment' VALUES
> ('01235',2,1,'Domestic','Fan','April 5th 1999','April 7th, 1, 'April
> 12th 1999','April 14th 1999',2),
> ('012357',2,1,'Domestic','Fan','May 1st 2000','May 3rd 2000','May 18th
> 2000','May 20th 2000',3),
> ('03278',3,7,'Domestic','Toothbrush','Ap
ril 12th 1999', 'April 15th
> 1999','April 16th 1999','April 20th 1999',1),
> ('03452',2,2,'Domestic','Fan','April 5th 1999','April 14th
> 1999'),('04577',1,8,'Commercial','Comput
er','May 1st 1999','May 5th
> 1999'),
> ('07853',1,9,'Commercial','Printer','May
1st 1999','May 5th
> 1999'),('08453',3,4,'Commercial','Comput
er','April 12th 1999','April
> 15th 1999'),
> ('084531',3,4,'Commercial','Computer','M
ay 5th 2000','May 6th
> 2000','May 8th 2000','May 10th
> 2000',1),('08734',3,6,'Industrial','Heat
er','April 12th 1999','April
> 15th 1999'),
> ('08892',3,3,'Commercial','Monitor','Apr
il 12th 1999','April 15th
> 1999'),('08897',1,10,'Commercial','Fax',
'May 1st 1999','May 5th
> 1999'),('08924',3,5,'Domestic','Kettle',
'April 12th 1999','April 13th
> 1999','April 17th 1999','April 20th 1999',2),
> ('089248',3,5,'Domestic','Kettle','May 5th 2000','May 10th
> 2000'),('089921',3,3,'Commercial','Monit
or','May 5th 2000','May 10th
> 2000');
>|||Do not put 'single quotes' around the table and object names.
As already noted, each row INSERTed needs its own INSERT.
Once you get those taken care of the problems that remain will be
easier to see.
Roy Harvey
Beacon Falls, CT
On 13 Dec 2006 02:28:25 -0800, "Daz01" <dazzaf15@.hotmail.com> wrote:

>Hi Im trying to build a database in Microsoft SQL Server 2005.
>Ive written the code, but when I execute it, I keep getting an error
>message (below)
>Msg 102, Level 15, State 1, Line 1
>Incorrect syntax near 'customer'.
>
>Code below, any help would be great!
>--Table structure for table 'customer'
>
>CREATE TABLE 'customer'(
>'CustID' int(10) NOT NULL AUTO_INCREMENT,
>'CustName' char(50) NOT NULL,
>'Address' char(50) NOT NULL,
>PRIMARY KEY ('CustID')
> )
>--Dumping data for table 'customer'
>INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
>Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
>(3,'DailyMurkInc','Fleet Marina');

Wednesday, March 21, 2012

Incorrect syntax

Hi Im trying to build a database in Microsoft SQL Server 2005.
Ive written the code, but when I execute it, I keep getting an error
message (below)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'customer'.
Code below, any help would be great!
--Table structure for table 'customer'
CREATE TABLE 'customer'(
'CustID' int(10) NOT NULL AUTO_INCREMENT,
'CustName' char(50) NOT NULL,
'Address' char(50) NOT NULL,
PRIMARY KEY ('CustID')
)
--Dumping data for table 'customer'
INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
(3,'DailyMurkInc','Fleet Marina');
--Table Structure for table 'deliverynote'
CREATE TABLE 'deliverynote'(
'CATref' int(20) NOT NULL auto_increment,
'CustID' int(50) NOT NULL,
'EquipCat' char(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'EquipName' char(50) NOT NULL,
PRIMARY KEY ('CATref','CustID')
)
--Dumping data for table 'deliverynote'
INSERT INTO 'deliverynote' VALUES
('01235',2,'Domestic',1,'Fan'),('03278',3,'Domestic',7,'Toothbrush'),('03452',2,'Domestic',2,'Fan'),
('04577',1,'Commercial',8,'Computer'),('07853',1,'Commercial',9,'Printer'),('08453',3,'Commercial',4,'Computer'),('08734',3,'Industrial',6,'Heater'),
('08897',1,'Commercial',10,'Fax'),('08924',3,'Domestic',5,'Kettle'),('08992',3,'Commercial',3,'Monitor');
--Table Structure for table 'engineer'
CREATE TABLE 'engineer'(
'EngineerName' char(50) NOT NULL,
PRIMARY KEY ('EngineerName')
}
--Dumping data for table 'engineer'
INSERT INTO 'engineer' VALUES ('Botchit'),('Fudgeit'),('Perfect');
--Table Structure for table 'equipmentcat'
CREATE TABLE 'equipmentcat' (
'EquipCat' char(50) NOT NULL,
PRIMARY KEY ('EquipCat')
)
--Dumping data for table 'equipmentcat'
INSERT INTO 'equipmentcat' VALUES
('Commercial'),('Domestic'),('Industrial');
--Table Structure for table 'repairer'
CREATE TABLE 'repairer' (
'RepID' int(10) NOT NULL,
'RepName' char(50) NOT NULL,
PRIMARY KEY ('RepID')
)
--Dumping data for table 'repairer'
INSERT INTO 'repairer' VALUES (1, 'Mr Green'),(2,'Mrs Brown'),(3,'Mr
White');
--Table Structure for table 'locationid'
CREATE TABLE 'locationid' (
'LocationName' char(50) NOT NULL,
PRIMARY KEY ('LocationName')
)
--Dumping data for table 'locationid'
INSERT INTO 'locationid' VALUES
('Despatch'),('Gone_Home'),('Goods_In'),('Repairer'),('Testing');
--Table Structure for table 'location'
CREATE TABLE 'location' (
'EquipNumber' int(20) NOT NULL,
'CATref' int(20) NOT NULL,
'Testing' char(50) NOT NULL,
'Despatchdate' char(50) NOT NULL,
PRIMARY KEY ('CATref')
FOREIGN KEY ('CATref')
)
--Dumping data for table 'location'
INSERT INTO 'location' VALUES (1,'01235','April 5th 1999, Aprl 13th
1999','April 14th 1999'),(10,'08997','May 3rd 1999','May 5th 1999'),
(2,'03452','April 5th 1999','April 6th 1999'),(3,'08992','April 12th
1999','April 13th 1999'),(4,'08453','April 12th 1999','April 14th
1999'),
(5,'08924','April 12th 1999, April 17th 1999','April 20th
1999'),(6,'08734','April 13th 1999','April 14th
1999'),(7,'03278','April 13th 1999, April 17th 1999','April 19th
1999'),
(8,'04577','May 3rd 1999','May 5th 1999'), (9,'07853','May 3rd
1999','May 5th 1999');
--Table Structure for table 'testrecord'
CREATE TABLE 'testrecord' (
'CATref' int(20) NOT NULL,
'CustID' int(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'Date' char(50) NOT NULL,
'EngineerName' char(50) NOT NULL,
'Pass/Fail' char(20) NOT NULL,
PRIMARY KEY ('CATref','CustID')
FOREIGN KEY ('CATref','CustID','EngineerName')
)
--Dumping data for table 'testrecord'
INSERT INTO 'testrecord' VALUES ('01235',2,1,'Fan','April 6th
1999','Botchit','Pass'),('012357',2,1,'Fan','May 2nd
2000','Fudgeit','Fail'),('03278',3,7,'Toothbrush','April 13th
1999','Perfect','Pass')
,('08453',3,4,'Computer','April 12th
1999','Botchit','Pass'),('084531',3,4,'Computer','May 6th
2000','Perfect','Pass'),('084532',3,4,'Computer','May 9th
2000','Botchit','Pass'),('08734',3,6,'Heater','April 13th
1999','Botchit','Pass'),
('08924',3,5,'Kettle','April 12th
1999','Perfect','Fail'),('089248',3,5,'Kettle','May 6th
2000','Fudgeit','Pass'),('08992',3,3,'Monitor','April 12th
1999','Fudgeit','Pass'),('089921',3,3,'Monitor','May 6th
2000','Perfect','Pass');
--Table Structure for table 'equipment'
CREATE TABLE 'equipment' (
'CATref' int(20) NOT NULL,
'CustID' int(50) NOT NULL,
'EquipNumber' int(20) NOT NULL,
'EquipCat' char(50) NOT NULL,
'EquipName' char(50) NOT NULL,
'Goods_In_Date' char(50) NOT NULL,
'Repairer_Date' char (50) NOT NULL,
'Despatch_Date' char(50) NOT NULL,
'Home_Date' char(50) NOT NULL,
'RepID' int(10) NOT NULL,
PRIMARY KEY ('CATref', 'CustID')
FOREIGN KEU ('RepID','EqipCat','CATref','CustID')
)
--Dumping data for table 'equipment'
INSERT INTO 'equipment' VALUES
('01235',2,1,'Domestic','Fan','April 5th 1999','April 7th, 1, 'April
12th 1999','April 14th 1999',2),
('012357',2,1,'Domestic','Fan','May 1st 2000','May 3rd 2000','May 18th
2000','May 20th 2000',3),
('03278',3,7,'Domestic','Toothbrush','April 12th 1999', 'April 15th
1999','April 16th 1999','April 20th 1999',1),
('03452',2,2,'Domestic','Fan','April 5th 1999','April 14th
1999'),('04577',1,8,'Commercial','Computer','May 1st 1999','May 5th
1999'),
('07853',1,9,'Commercial','Printer','May 1st 1999','May 5th
1999'),('08453',3,4,'Commercial','Computer','April 12th 1999','April
15th 1999'),
('084531',3,4,'Commercial','Computer','May 5th 2000','May 6th
2000','May 8th 2000','May 10th
2000',1),('08734',3,6,'Industrial','Heater','April 12th 1999','April
15th 1999'),
('08892',3,3,'Commercial','Monitor','April 12th 1999','April 15th
1999'),('08897',1,10,'Commercial','Fax','May 1st 1999','May 5th
1999'),('08924',3,5,'Domestic','Kettle','April 12th 1999','April 13th
1999','April 17th 1999','April 20th 1999',2),
('089248',3,5,'Domestic','Kettle','May 5th 2000','May 10th
2000'),('089921',3,3,'Commercial','Monitor','May 5th 2000','May 10th
2000');Daz
You have to specify INSERT INTO for each data to be insterted in your case
See if this helps
INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway Cuttings,
Euphoria')
INSERT INTO 'customer' VALUES (2,'Sinking.com','Virtual Lane, Peckham')
INSERT INTO 'customer' VALUES (3,'DailyMurkInc','Fleet Marina');
"Daz01" <dazzaf15@.hotmail.com> wrote in message
news:1166005705.720733.30310@.73g2000cwn.googlegroups.com...
> Hi Im trying to build a database in Microsoft SQL Server 2005.
> Ive written the code, but when I execute it, I keep getting an error
> message (below)
> Msg 102, Level 15, State 1, Line 1
> Incorrect syntax near 'customer'.
>
> Code below, any help would be great!
> --Table structure for table 'customer'
>
> CREATE TABLE 'customer'(
> 'CustID' int(10) NOT NULL AUTO_INCREMENT,
> 'CustName' char(50) NOT NULL,
> 'Address' char(50) NOT NULL,
> PRIMARY KEY ('CustID')
> )
> --Dumping data for table 'customer'
> INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
> Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
> (3,'DailyMurkInc','Fleet Marina');
>
> --Table Structure for table 'deliverynote'
>
> CREATE TABLE 'deliverynote'(
> 'CATref' int(20) NOT NULL auto_increment,
> 'CustID' int(50) NOT NULL,
> 'EquipCat' char(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'EquipName' char(50) NOT NULL,
> PRIMARY KEY ('CATref','CustID')
> )
> --Dumping data for table 'deliverynote'
> INSERT INTO 'deliverynote' VALUES
> ('01235',2,'Domestic',1,'Fan'),('03278',3,'Domestic',7,'Toothbrush'),('03452',2,'Domestic',2,'Fan'),
> ('04577',1,'Commercial',8,'Computer'),('07853',1,'Commercial',9,'Printer'),('08453',3,'Commercial',4,'Computer'),('08734',3,'Industrial',6,'Heater'),
> ('08897',1,'Commercial',10,'Fax'),('08924',3,'Domestic',5,'Kettle'),('08992',3,'Commercial',3,'Monitor');
>
> --Table Structure for table 'engineer'
> CREATE TABLE 'engineer'(
> 'EngineerName' char(50) NOT NULL,
> PRIMARY KEY ('EngineerName')
> }
> --Dumping data for table 'engineer'
> INSERT INTO 'engineer' VALUES ('Botchit'),('Fudgeit'),('Perfect');
>
> --Table Structure for table 'equipmentcat'
> CREATE TABLE 'equipmentcat' (
> 'EquipCat' char(50) NOT NULL,
> PRIMARY KEY ('EquipCat')
> )
> --Dumping data for table 'equipmentcat'
>
> INSERT INTO 'equipmentcat' VALUES
> ('Commercial'),('Domestic'),('Industrial');
>
> --Table Structure for table 'repairer'
> CREATE TABLE 'repairer' (
> 'RepID' int(10) NOT NULL,
> 'RepName' char(50) NOT NULL,
> PRIMARY KEY ('RepID')
> )
> --Dumping data for table 'repairer'
> INSERT INTO 'repairer' VALUES (1, 'Mr Green'),(2,'Mrs Brown'),(3,'Mr
> White');
>
> --Table Structure for table 'locationid'
> CREATE TABLE 'locationid' (
> 'LocationName' char(50) NOT NULL,
> PRIMARY KEY ('LocationName')
> )
> --Dumping data for table 'locationid'
>
> INSERT INTO 'locationid' VALUES
> ('Despatch'),('Gone_Home'),('Goods_In'),('Repairer'),('Testing');
>
> --Table Structure for table 'location'
> CREATE TABLE 'location' (
> 'EquipNumber' int(20) NOT NULL,
> 'CATref' int(20) NOT NULL,
> 'Testing' char(50) NOT NULL,
> 'Despatchdate' char(50) NOT NULL,
> PRIMARY KEY ('CATref')
> FOREIGN KEY ('CATref')
> )
> --Dumping data for table 'location'
>
> INSERT INTO 'location' VALUES (1,'01235','April 5th 1999, Aprl 13th
> 1999','April 14th 1999'),(10,'08997','May 3rd 1999','May 5th 1999'),
> (2,'03452','April 5th 1999','April 6th 1999'),(3,'08992','April 12th
> 1999','April 13th 1999'),(4,'08453','April 12th 1999','April 14th
> 1999'),
> (5,'08924','April 12th 1999, April 17th 1999','April 20th
> 1999'),(6,'08734','April 13th 1999','April 14th
> 1999'),(7,'03278','April 13th 1999, April 17th 1999','April 19th
> 1999'),
> (8,'04577','May 3rd 1999','May 5th 1999'), (9,'07853','May 3rd
> 1999','May 5th 1999');
>
> --Table Structure for table 'testrecord'
> CREATE TABLE 'testrecord' (
> 'CATref' int(20) NOT NULL,
> 'CustID' int(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'Date' char(50) NOT NULL,
> 'EngineerName' char(50) NOT NULL,
> 'Pass/Fail' char(20) NOT NULL,
> PRIMARY KEY ('CATref','CustID')
> FOREIGN KEY ('CATref','CustID','EngineerName')
> )
> --Dumping data for table 'testrecord'
> INSERT INTO 'testrecord' VALUES ('01235',2,1,'Fan','April 6th
> 1999','Botchit','Pass'),('012357',2,1,'Fan','May 2nd
> 2000','Fudgeit','Fail'),('03278',3,7,'Toothbrush','April 13th
> 1999','Perfect','Pass')
> ,('08453',3,4,'Computer','April 12th
> 1999','Botchit','Pass'),('084531',3,4,'Computer','May 6th
> 2000','Perfect','Pass'),('084532',3,4,'Computer','May 9th
> 2000','Botchit','Pass'),('08734',3,6,'Heater','April 13th
> 1999','Botchit','Pass'),
> ('08924',3,5,'Kettle','April 12th
> 1999','Perfect','Fail'),('089248',3,5,'Kettle','May 6th
> 2000','Fudgeit','Pass'),('08992',3,3,'Monitor','April 12th
> 1999','Fudgeit','Pass'),('089921',3,3,'Monitor','May 6th
> 2000','Perfect','Pass');
>
> --Table Structure for table 'equipment'
> CREATE TABLE 'equipment' (
> 'CATref' int(20) NOT NULL,
> 'CustID' int(50) NOT NULL,
> 'EquipNumber' int(20) NOT NULL,
> 'EquipCat' char(50) NOT NULL,
> 'EquipName' char(50) NOT NULL,
> 'Goods_In_Date' char(50) NOT NULL,
> 'Repairer_Date' char (50) NOT NULL,
> 'Despatch_Date' char(50) NOT NULL,
> 'Home_Date' char(50) NOT NULL,
> 'RepID' int(10) NOT NULL,
> PRIMARY KEY ('CATref', 'CustID')
> FOREIGN KEU ('RepID','EqipCat','CATref','CustID')
> )
> --Dumping data for table 'equipment'
> INSERT INTO 'equipment' VALUES
> ('01235',2,1,'Domestic','Fan','April 5th 1999','April 7th, 1, 'April
> 12th 1999','April 14th 1999',2),
> ('012357',2,1,'Domestic','Fan','May 1st 2000','May 3rd 2000','May 18th
> 2000','May 20th 2000',3),
> ('03278',3,7,'Domestic','Toothbrush','April 12th 1999', 'April 15th
> 1999','April 16th 1999','April 20th 1999',1),
> ('03452',2,2,'Domestic','Fan','April 5th 1999','April 14th
> 1999'),('04577',1,8,'Commercial','Computer','May 1st 1999','May 5th
> 1999'),
> ('07853',1,9,'Commercial','Printer','May 1st 1999','May 5th
> 1999'),('08453',3,4,'Commercial','Computer','April 12th 1999','April
> 15th 1999'),
> ('084531',3,4,'Commercial','Computer','May 5th 2000','May 6th
> 2000','May 8th 2000','May 10th
> 2000',1),('08734',3,6,'Industrial','Heater','April 12th 1999','April
> 15th 1999'),
> ('08892',3,3,'Commercial','Monitor','April 12th 1999','April 15th
> 1999'),('08897',1,10,'Commercial','Fax','May 1st 1999','May 5th
> 1999'),('08924',3,5,'Domestic','Kettle','April 12th 1999','April 13th
> 1999','April 17th 1999','April 20th 1999',2),
> ('089248',3,5,'Domestic','Kettle','May 5th 2000','May 10th
> 2000'),('089921',3,3,'Commercial','Monitor','May 5th 2000','May 10th
> 2000');
>|||Do not put 'single quotes' around the table and object names.
As already noted, each row INSERTed needs its own INSERT.
Once you get those taken care of the problems that remain will be
easier to see.
Roy Harvey
Beacon Falls, CT
On 13 Dec 2006 02:28:25 -0800, "Daz01" <dazzaf15@.hotmail.com> wrote:
>Hi Im trying to build a database in Microsoft SQL Server 2005.
>Ive written the code, but when I execute it, I keep getting an error
>message (below)
>Msg 102, Level 15, State 1, Line 1
>Incorrect syntax near 'customer'.
>
>Code below, any help would be great!
>--Table structure for table 'customer'
>
>CREATE TABLE 'customer'(
>'CustID' int(10) NOT NULL AUTO_INCREMENT,
>'CustName' char(50) NOT NULL,
>'Address' char(50) NOT NULL,
>PRIMARY KEY ('CustID')
>)
>--Dumping data for table 'customer'
>INSERT INTO 'customer' VALUES (1,'Railtrack HQ','25-49 Railway
>Cuttings, Euphoria'),(2,'Sinking.com','Virtual Lane, Peckham'),
>(3,'DailyMurkInc','Fleet Marina');

Monday, March 12, 2012

inconsistent Timeout Expired with extended SP execute

All,
I've successfully executed my extended stored proc multiple times via
the following. If I directly execute(e.g., right-click 'Execute'
within my DB editor) this stored procedure, it runs everytime and
finishes in 1-2 seconds. If I try to execute the SP via my trigger, it
returns a 'Timeout Expired' message. But - not every time. I have got
the trigger to fire the SP a few (seemingly random) times without
timing out. Any help would be fantastic...
Pre-Thanks,
sara
my SP:
ALTER procedure dbo.WriteDNFiles
as
declare @.return varchar
EXEC @.return = master.dbo.XYRunProc 'C:\WRITE_DN_FILES.exe'
my trigger:
ALTER TRIGGER TriggerEmp
ON dbo.Employees
FOR INSERT, UPDATE
AS
exec WriteDNFilesHi sara
Running a program in a trigger is not a good idea as it will prolong the
transaction and there increase contention which could possibly be what you
are experiencing. You may want to make sure that you are not having any file
access problems if two process are wanting to call the program simultanously
.
Another general point is that you should change @.@.ROWCOUNT in the trigger to
see if anything has changed, if not don't call your procedure.
John
"skeddy@.gmail.com" wrote:

> All,
> I've successfully executed my extended stored proc multiple times via
> the following. If I directly execute(e.g., right-click 'Execute'
> within my DB editor) this stored procedure, it runs everytime and
> finishes in 1-2 seconds. If I try to execute the SP via my trigger, it
> returns a 'Timeout Expired' message. But - not every time. I have got
> the trigger to fire the SP a few (seemingly random) times without
> timing out. Any help would be fantastic...
> Pre-Thanks,
> sara
> my SP:
> ALTER procedure dbo.WriteDNFiles
> as
> declare @.return varchar
> EXEC @.return = master.dbo.XYRunProc 'C:\WRITE_DN_FILES.exe'
> my trigger:
> ALTER TRIGGER TriggerEmp
> ON dbo.Employees
> FOR INSERT, UPDATE
> AS
> exec WriteDNFiles
>

inconsistent Timeout Expired with extended SP execute

All,
I've successfully executed my extended stored proc multiple times via
the following. If I directly execute(e.g., right-click 'Execute'
within my DB editor) this stored procedure, it runs everytime and
finishes in 1-2 seconds. If I try to execute the SP via my trigger, it
returns a 'Timeout Expired' message. But - not every time. I have got
the trigger to fire the SP a few (seemingly random) times without
timing out. Any help would be fantastic...
Pre-Thanks,
sara
my SP:
ALTER procedure dbo.WriteDNFiles
as
declare @.return varchar
EXEC @.return = master.dbo.XYRunProc 'C:\WRITE_DN_FILES.exe'
my trigger:
ALTER TRIGGER TriggerEmp
ON dbo.Employees
FOR INSERT, UPDATE
AS
exec WriteDNFilesHi sara
Running a program in a trigger is not a good idea as it will prolong the
transaction and there increase contention which could possibly be what you
are experiencing. You may want to make sure that you are not having any file
access problems if two process are wanting to call the program simultanously.
Another general point is that you should change @.@.ROWCOUNT in the trigger to
see if anything has changed, if not don't call your procedure.
John
"skeddy@.gmail.com" wrote:
> All,
> I've successfully executed my extended stored proc multiple times via
> the following. If I directly execute(e.g., right-click 'Execute'
> within my DB editor) this stored procedure, it runs everytime and
> finishes in 1-2 seconds. If I try to execute the SP via my trigger, it
> returns a 'Timeout Expired' message. But - not every time. I have got
> the trigger to fire the SP a few (seemingly random) times without
> timing out. Any help would be fantastic...
> Pre-Thanks,
> sara
> my SP:
> ALTER procedure dbo.WriteDNFiles
> as
> declare @.return varchar
> EXEC @.return = master.dbo.XYRunProc 'C:\WRITE_DN_FILES.exe'
> my trigger:
> ALTER TRIGGER TriggerEmp
> ON dbo.Employees
> FOR INSERT, UPDATE
> AS
> exec WriteDNFiles
>

Friday, February 24, 2012

In Yukon, can EXECUTE AS be disabled?

For SQL Server 2005, can EXECUTE AS be disabled? If so, how?
Thanks,
Larry ChesnutFrom SQL Server 2005 BOL:
Server or database principals other than sa or dbo can call EXECUTE AS.
The user calling the EXECUTE AS statement must have IMPERSONATE permissions
on the target principal
If it is not granted, it can be executed as.
http://communities.microsoft.com/ne...lcid=us

--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Larry Chesnut" <Larry@.scalabilityexpertsonline.com> wrote in message
news:%23iRHOw2lFHA.2080@.TK2MSFTNGP14.phx.gbl...
> For SQL Server 2005, can EXECUTE AS be disabled? If so, how?
>
> Thanks,
> Larry Chesnut
>

Sunday, February 19, 2012

IN SQL SERVER BCP

Hi,

I have to insert a data from text file to Sql Server Using BULK INSERT ie BCP. Throgh qurey wise it execute fine.
But using stored procedure it does not work..here just i have to pass 1 parameter ie file name. The err is

" Could not bulk insert. File '@.BasicFile' does not exist." How can i solve the prolblem ?

Thanks and Regards,

ArulIt looks like you are trying to use a variable filename for your source file. As far as I know, you will need to use dynamic SQL to accomplish this.


SET @.SQL = "BULK INSERT myTable '"+@.PathFileName+"' WITH (FIELDTERMINATOR = ',') "
EXEC (@.SQL)

Terri