Stored procedures can be multistep. I noticed that you have a rollback transaction, but no begin transaction. Assuming that the sp is a self contained transaction you should alter your sp to include a begin transaction
create procedure ...... as
begin transaction
insert ...
if ...
I suspect that somewhere in your 31,000 records column 32 has a character string that can not be parsed as an integer number. When you let DTS create the table I would guess that it has built the table with a type of char (or varchar) for col 32. Given that you can load a portion of the file...
Ok agreed..
while column = NULL or column = @v (where @v is NULL) evals to TRUE columnA = columnB evals to FALSE when both are null. See also
http://support.microsoft.com/support/kb/articles/Q214/6/01.ASP
The workaround would be
insert into...
I'm not sure I understand your expectation:-
With set ansii_nulls off are you expecting:
siteid=#TempItems.SiteID
to evaluate to true if siteid is null and #TempItems.SiteID is not null?
1) Start query analyser. You should find it under:
Start-> Programs -> MS SQL Server 7.0 -> Query Analyzer
2) Connect to your SQL Server,
3) If your database is called foo type:-
dbcc shrinkdatabase (foo, notruncate)
However if you need SQL Server to release the space back to the file...
How about trying:-
insert into [stats](StatDate,SiteID,SiteName,StatType,UniqueHits,TotalHits,JoinHits)
select *, JoinHits = (select count(*) from referer where refdirection='OUT' and RefType=#TempItems.StatType and refdate=#TempItems.StatDate
and (siteid=#TempItems.SiteID or siteid is NULL)...
If you're talking about T-SQL in a stored procedure thenyou can use the builtin @@rowcount variable:
select ... from ... where
if @@rowcount=0
begin
print "No Records Matched"
return
end
In this situation implicit conversion is not performed. In other circumstances such as passing a smallint variable to a stored procedure integer parameter, implicit conversion is performed. Take a look at "Data Type Conversion" in the BOL.
Also you can use either CONVERT or CAST.
If you can add an entry to the source table for SEK e.g.
Date Currency Currency_Rate
1 DKK 1,2
1 EUR 7,8
1 SEK 1,0
then a non-equi join will do it:
select a.date, a.code,b.code, a.rate/b.rate
from exchange a ,exchange b
where a.code <> b.code
If...
Looks like @PaymentTypeCode is the problem.
Change:
SET @Payment_Types_XML = @Payment_Types_XML + "<PMT_TYP_CD>" + @PaymentTypeCode + "</PMT_TYP_CD>" + "<PMT_TYP_DESC>" + @PaymentTypeDescription + "</PMT_TYP_DESC>"
to:
SET @Payment_Types_XML =...
Does this server participate in a replicated environment? We had a similar problem in our replicated environment. If I remember correctly, the replication set up sp's manipulate the sysservers table, and this caused problems... Sorry I couldn't be more specific, but it was about 1 yr ago.
I don't know general sql stmt that will work if LocalityX is not known a priori. However if it is known e.g. the only localities are A,B,C then you can write sql such as:
select distinct z.CustName,
Locality1=a.Locality,
Locality2=b.Locality,
Locality3=c.Locality
from geo z, geo a , geo b...
You request is not clear. Could you elaborate. To project out the balance column, the SQL is for example:
select Balance from Ledger
However I expect this is not what you mean.
It may be a bug. You don't say which tool you're using (Enterprise mgr?) however, take a look at these MS articles:
http://support.microsoft.com/support/kb/articles/Q273/4/72.ASP
http://support.microsoft.com/support/kb/articles/Q193/3/39.ASP
I agree with balves. This should do it, according to the requirements in your post:
select CustId,OrderId,max([datetimestamp]) from [order] group by CustId, OrderId
It returns the latest entry for each CustId, OrderId combo.
This is a known problem with the Enterprise manager. See
artcle Q268505 at MS support
http://support.microsoft.com/support/kb/articles/Q268/5/05.ASP
The workaround is to use a delete stmt in the query analyzer e.g
delete from foo where ...
1)You can enable inserts to an identity column via set. i.e.
SET IDENTITY_INSERT [database.[owner.]]{table} ON
The limitation is a session can only have one table with identity_insert activated at any one time. So your script will have to bracket insert stmts with SET ON and OFF commands.
OR...
Before I answer, a question: Are you sure the select will only return one row? Ie if district_id is NULL then state_id is NOT NULL. I ask because your logic appears to be assuming this.
Using TSQL against a database called foo:
exec sp_dboption foo, 'trunc. log on chkpt', 'true'
checkpoint
This will truncate the inactive part of the transaction log once the checkpoint completes. However understand what you're doing before altering dboptions -- look in BOL under sp_dboption...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.