|
You probably need to split your query down to isolate the actual updates, then the problem will be reduced. Take locks late and release early is the best advice I can give.
You can increase the timeout on the command or connection.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I have also faced the same problem when i used multithreading with very complex query that takes 25 sec to execute. and there are multiple threads so they hit the sql server with the same query at a time which cause Time Out Expired...
I think following might help you.
You can view the Locks by executing
sp_lock
Also try these undocumented system stored procedures to get the info about blocking.
sp_who
sp_who2
Read this MSDN KB Article and Try to divide the update/delete statement by block of rows like this [^]
|
|
|
|
|
I am building a VB.Net system using MySql database from XAMPP.
The problem is, i try to run the system from other computer and change the localhost to 10.0.0.15 because the 10.0.0.15 is the ip for the computer running the database. But, i get the error message "Unable to connect to any of the specified MySQL hosts"
I do a lot of searching and i find that i need to add privilage to mysql. But i try many time and still fail. I not really sure how to add it. I am really new to it. I am using phpmyadmin running windows xp.
So, example computer A has the mysql server install(using XAMPP) and the ip adress is 10.0.0.15.
On the other hand, i install the system on computer B(IP = 10.0.0.20) and want to run the system from computer B but access the database at computer A. So, what is the thing that i need to do?
Could someone tell me what i need to add at the privileges and at the connection string, what i need to put at the 'Server' for the connection string?
Example connection string:
server=localhost; user id=root; password=; database=cegms;
Thank.
|
|
|
|
|
Shouldn't the server be 10.0.0.15 instead of localhost? Eliminate all the LAN issues if any and enable the port 3306. When you are trying out the connection, is the Mysql service running or not?
---------------------------
Both optimists and pessimists are important in technology. The optimist invented the aeroplane; the pessimist invented the parachute.
Regards,
Hesbon Ongira
Nairobi, Kenya.
|
|
|
|
|
I already change the localhost to 10.0.0.15 actually. I think the problem is on mysql. I am using phpmyadmin. Could you tell me how to enable the port 3306? And any other thing that i need to configure?
I also do some searching and found need to "grant access to remote IP address" but i does not know how to do it!
I am really new and never configure the mysql, so any detail explain of the step is appreciated.
Thank you.
|
|
|
|
|
Just Reconstruct My Question
i have the following function
public static int AddParent(ParentEntity objParentEntity)
{
return ((int)(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner + "CreateParent"
,objParentEntity.ParentName
)));
}
and this stored procedure
ALTER PROCEDURE [dbo].[CreateParent] <br />
(<br />
@ParentName nvarchar(MAX)<br />
)<br />
AS<br />
BEGIN<br />
insert into [dbo].[Parent]<br />
(<br />
[ParentName]<br />
)<br />
VALUES <br />
( <br />
@ParentName<br />
)<br />
RETURN SCOPE_IDENTITY();<br />
END
the SP work fine
the error is the follwoing
Object reference not set to an instance of an object.
i think it is when it is returning the value because when i used CONVERT.TOINT32 it retrun 0
the point from all of this is to create a recored and then take its generated ID to use it somewhere else
so can someone help me and tell me what i did wrong
modified on Monday, May 26, 2008 6:02 AM
|
|
|
|
|
You never assign any other values to it then the value in
SELECT @ParentID = ParentId FROM Parent WHERE ParentNationalNumber = @ParentNationalNumber
Is that not the correct value? If it isn't, then you must assign another value.
|
|
|
|
|
Hi all,
I m hgetting this strange message while ctreating a trigger. I can`t figure out the problem
create TRIGGER TRIG_SS_BUFFER ON INVOICE_MAIN
FOR INSERT
AS
INSERT INTO SS_BUFFER
{
SS_INV_NO,
SS_INV_USER_NO,
SS_INV_DATE,
SS_BUF_ORDER_NO,
SS_BILL_LOC_CODE,
SS_SUPP_LOC_CODE,
SS_PARTY_CODE
}
SELECT INS.INVOICE_NO, INS.INVOICE_USR_NO, INS.INVOICE_DATE, INS.INVOICE_REF_NO,
ORDER_MAIN.ORDER_BILL_LOC_CODE, ORDER_MAIN.ORDER_SUP_LOC_CODE, ORDER_MAIN.ORDER_PARTY_CODE
FROM INSERTED INS INNER JOIN
ORDER_MAIN ON INS.INVOICE_REF_NO = ORDER_MAIN.ORDER_NO
Any help would be appreciated....
When you fail to plan, you are planning to fail.
|
|
|
|
|
It was a typo. I have used '{' instead of '('. Sorry Again!!!!
When you fail to plan, you are planning to fail.
|
|
|
|
|
hai,
curretly i m using sql server 2000.
here, When i insert a record to "Table-A", an auto generated number will be stored in column "Col-AutoID" (say... 7). This 7 should be immediately stored in column "Col2-AutoID" of "Table-B".
how to proceed it with triggers?. help me. - KARAN
|
|
|
|
|
currently i m using sql server 2000.
i need a query where i would like to get the DISTINCT records from table "A" and copy to table "B".
For example...
table A consist of...
1 - testvalue
2 - testing
3 - processing
1 - testvalue
3 - processing
then the table B resultant should be of...
1 - testvalue
2 - testing
3 - processing
Since the column which going to carry the 1,2 and 3 values is PRIMARY KEY.
how to achieve it? - KARAN
|
|
|
|
|
insert into tableB select distinct col1,col2,col3 from TableA
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
thanks blue boy... but the thing is i m having nearly 50 columns in my table "A". I want to remove the duplicate records from table "A" (depending upon the 1st column), and insert the values in table "B" as setting the 1st column as PRIMARY KEY.......
Now, my questing is as u said...
insert into tableB select distinct col1,col2,col3... col 50 from TableA
do i want to mention all the 50 columns???????
|
|
|
|
|
So do you want distinct rows or distinct based on a specific column - if its the first then you have the answer, otherwise you are not asking the right question
Bob
Ashfield Consultants Ltd
|
|
|
|
|
How can I assign the result of a query to a variable. For example
DECLARE @FoundID VARCHAR(10)
IF NOT EXISTS(SELECT @FoundID = Employee.EmployeeID
FROM Employee
JOIN EmployeeTerritory
ON Employee.EmployeeID = EmployeeTerritory.EmployeeID
JOIN Territory
ON EmployeeTerritory.TerritoryID = Territory.TerritoryID
WHERE AssignedPostal = SUBSTRING(@CustomerPostalCode, 1, 1))
RAISERROR('The speicified CustomerPostalCode is not assigned to any salesperson! Unassigned PostalCode!', 11, 1)
So basically I want to assign Employee.EmployeeID from the query result to the variable. Most examples online show assigning result of aggregate functions to variables.
Thanks
|
|
|
|
|
CodingYoshi wrote: So basically I want to assign Employee.EmployeeID from the query result to the variable. Most examples online show assigning result of aggregate functions to variables.
If your SELECT results in only one row being returned then it should work. However, you are doing the assignment inside an IF (NOT) EXISTS which doesn't obey the normal rules of processing. It is designed to short circuit as soon as any matching data is found in order to allow the appropriate conditional statements to be run.
I would suggest moving the SELECT out of the IF condition and changing the IF condition to an ISNULL(@FoundId).
|
|
|
|
|
ISNULL(@FoundID) takes 2 parameters and when provided results in error. But this works
IF @FoundID IS NULL
RAISERROR('The speicified CustomerPostalCode is not assigned to any salesperson! Unassigned PostalCode!', 11, 1)
ELSE
SET @SalesPersonID = @FoundID
Thanks for advising to move the select statement out of if statement.
|
|
|
|
|
CodingYoshi wrote: ISNULL(@FoundID) takes 2 parameters and when provided results in error.
Ah yes... Sorry, I was going off the top of my head. Glad it still pointed you in roughly the right direction.
|
|
|
|
|
DECLARE @FoundID VARCHAR(10)
SELECT @FoundID = Employee.EmployeeID
FROM Employee
JOIN EmployeeTerritory
ON Employee.EmployeeID = EmployeeTerritory.EmployeeID
JOIN Territory
ON EmployeeTerritory.TerritoryID = Territory.TerritoryID
WHERE AssignedPostal = SUBSTRING(@CustomerPostalCode, 1, 1)
IF NOT EXISTS(@FoundID)
RAISERROR('The speicified CustomerPostalCode is not assigned to any salesperson! Unassigned PostalCode!', 11, 1)
|
|
|
|
|
NOT EXISTS(@FoundID) results in error. But this works
IF @FoundID IS NULL
RAISERROR('The speicified CustomerPostalCode is not assigned to any salesperson! Unassigned PostalCode!', 11, 1)
ELSE
SET @SalesPersonID = @FoundID
Thanks for advising to move the select statement out of if statement.
|
|
|
|
|
Could some please translate this error to human language?
I get it after I attempt to do recordset update.
What is a descriptor index and if it is invalid what is is?
Can I get more info from VC 6.0??
Thanks for reading.
Vaclav
PS Yes I did google it and came up with nothing solid.
|
|
|
|
|
I have developed a project for a tutor academy in VS2005. For data accessing I used SQL Server 2005 Express features like Data Adapter etc. Now I want to implement the data accessing through ADO.NET. Is there any conversion tool available on the internet which can translate / convert data accessing methodology of SQL Server Express to ADO.NET? If not how can I achieve it?
DotGuru
|
|
|
|
|
kashshay wrote: I used SQL Server 2005 Express features like Data Adapter etc. Now I want to implement the data accessing through ADO.NET
Data adapter is an ado.net technology, sql express has nothing to do with it. So you arr already using ado.net.
|
|
|
|
|
hi
I want to know how can i connect to other pc sqlserver with another pc
over lan connection
Thanks
|
|
|
|
|
You have to enable TCP/IP on the SQL Server. By default it is switched off. You can do this in the SQL Server Configuration Manager.
You will then be able to connect to the SQL Server from other PCs.
|
|
|
|