fniles
2010-05-21 16:28:41 UTC
I am using VB6, ADO and SQL Server 2005 as the database.
I have a stored procedure like this:
alter PROCEDURE [dbo].[INSERT_INTO_HistTradesOrigtest]
@ID int output,
@Floor varchar(50) = NULL,
@Order varchar(50) = NULL
AS
insert into HistTradesOrig
([Floor],[Order])
values
(@Floor,@Order)
This is the table
CREATE TABLE [dbo].[HistTradesOrigTest](
[ID] [int] IDENTITY(1,1) NOT NULL,
[LOG] [smallint] NULL,
[Floor] [varchar](50) NULL,
[order] [varchar](50) NOT NULL,
CONSTRAINT [PK__HistTradesOrig__6FE99F9F] PRIMARY KEY CLUSTERED
(
[order] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SQL Server is on our server, and the test database that I am using only has
30 rows in the table that I am inserting, and I am the only one who is using
the database.
There are other databases that are pretty actively being used on that SQL
Server.
On my machine when I call that stored procedure from the program, sometimes
it takes 1 milliseconds to insert the record to the table, but sometimes it
takes 16 miliseconds to do it.
What could cause the time difference in the insertion, when I am the only
user in the database ?
Thank you for your help.
Set m_cmd = New ADODB.Command
Set m_cmd.ActiveConnection = adoCon
m_cmd.CommandType = adCmdStoredProc
m_cmd.CommandText = sCommandText
m_sCommandText = sCommandText
m_cmd.Parameters.Append m_cmd.CreateParameter("ID", adInteger,
adParamOutput, 12)
m_cmd.Parameters.Append m_cmd.CreateParameter("Floor", adVarChar,
adParamInput, 50)
m_cmd.Parameters.Append m_cmd.CreateParameter("ORDER", adVarChar,
adParamInput, 50)
m_cmd.Parameters("Floor").Value = ""
m_cmd.Parameters("ORDER").Value = "1"
m_cmd.Execute
I have a stored procedure like this:
alter PROCEDURE [dbo].[INSERT_INTO_HistTradesOrigtest]
@ID int output,
@Floor varchar(50) = NULL,
@Order varchar(50) = NULL
AS
insert into HistTradesOrig
([Floor],[Order])
values
(@Floor,@Order)
This is the table
CREATE TABLE [dbo].[HistTradesOrigTest](
[ID] [int] IDENTITY(1,1) NOT NULL,
[LOG] [smallint] NULL,
[Floor] [varchar](50) NULL,
[order] [varchar](50) NOT NULL,
CONSTRAINT [PK__HistTradesOrig__6FE99F9F] PRIMARY KEY CLUSTERED
(
[order] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SQL Server is on our server, and the test database that I am using only has
30 rows in the table that I am inserting, and I am the only one who is using
the database.
There are other databases that are pretty actively being used on that SQL
Server.
On my machine when I call that stored procedure from the program, sometimes
it takes 1 milliseconds to insert the record to the table, but sometimes it
takes 16 miliseconds to do it.
What could cause the time difference in the insertion, when I am the only
user in the database ?
Thank you for your help.
Set m_cmd = New ADODB.Command
Set m_cmd.ActiveConnection = adoCon
m_cmd.CommandType = adCmdStoredProc
m_cmd.CommandText = sCommandText
m_sCommandText = sCommandText
m_cmd.Parameters.Append m_cmd.CreateParameter("ID", adInteger,
adParamOutput, 12)
m_cmd.Parameters.Append m_cmd.CreateParameter("Floor", adVarChar,
adParamInput, 50)
m_cmd.Parameters.Append m_cmd.CreateParameter("ORDER", adVarChar,
adParamInput, 50)
m_cmd.Parameters("Floor").Value = ""
m_cmd.Parameters("ORDER").Value = "1"
m_cmd.Execute