Reputation: 11
I have a windows service application that imports a CSV file. During the import process, the application runs a series of queries to the database. During stress testing, we tried importing a CSV with 40k records. That means at least 40k queries to the database. Normally the queries run fine but there are times that the application would randomly get an error from the db " Invalid object name 'TableName' ".
Any idea what could be causing the error? I know that it's not in the query since the query executes successfully most of the time.
This is the actual query that I captured using the Text Visualizer. This runs successfully in SSMS
SELECT c.MemberInternalKey,
c.ClubCardId,
c.RestrictionId,
c.ExpirationDate,
m.ExternalMemberKey,
m.BuyingUnitInternalKey,
b.ExternalBuyingUnit,
b.PostalCode,
b.Country,
b.Street1,
b.City,
b.HomePhone,
b.EmailAddress,
b.SendEmail,
m2.ExternalMemberKey as OldestExternalMemberKey,
m2.BirthDate,
m2.MobilePhoneNumber,
m2.WorkPhoneNumber,
m2.Gender
FROM dbo.CRM_Clubcard c
INNER JOIN dbo.CRM_Member m ON c.MemberInternalKey = m.MemberInternalKey
INNER JOIN dbo.CRM_BuyingUnit b ON m.BuyingUnitInternalKey = b.BuyingUnitInternalKey
INNER JOIN dbo.CRM_Member m2 ON m2.BuyingUnitInternalKey = m.BuyingUnitInternalKey
WHERE c.ClubInternalKey = 2
AND c.ClubCardId = '1004303119'
AND m2.IsMainMember = 1
Upvotes: 1
Views: 384
Reputation: 11
I have fixed the issue by re-initializing the connection string for every method call / query to the database. Running the profiler was a big help.
Upvotes: 0