for some reason, SQL cannot open the file below. I checked the path and in the run prompt it opens fine. It's a synax error I think but the error doesn't say, it's just a generic error:
BULK INSERT tablename FROM 'c:\Documents and Settings\sss\Desktop\myfile.txt'
How can I tell the scheduler to run at certain times for specific time zones in SQL Server 2000? I don't see a time zone option, just daily, weekly, etc. then times
In my query below, is HAVING cb.CurrentBalance <> SUM(rf10.rmstranamt10) - SUM(rf.rmstranamt)
the same as the value that my CASE statements come up with for [balance] ?
Isn't putting straight SUM(rf10.rmstranamt10) - SUM(rf.rmstranamt) overriding what I want to be there which is:
HAVING...
Here's the SUM portion of my code:
INNER JOIN
(
SELECT RMSFILENUM,
RMSTRANCDE,
SUM(
CASE WHEN rmstrancde IN ('50','51','52','53') AND rmstrancde < 0 THEN
rmstranamt
WHEN rmstrancde IN ('50','51','52','53') AND rmstrancde >= 0...
SUM(
CASE WHEN rmstrancde IN ('50','51','52','53')
THEN (0 - ABS(DISTINCT rmstranamt))
WHEN rmstrancde IN ('55','56','57','58')
THEN ABS(DISTINCT rmstranamt)
ELSE
DISTINCT rmstranamt
END
) As rmstranamt
ERROR...
What I want to do is because I cannot perform cursor transactions inside an INNER JOIN, I need to take the following portion out below and throw that filter into a temp table first at the very top of my entire stored procedure.
Then I need to reverence that temp table instead of teh RFINAL...
I am trying to do a cursor and such in one of my INNER JOINS which is part of a bigger SQL statement. I am getting the following errors:
Msg 156, Level 15, State 1, Procedure Balance_Query, Line 61
Incorrect syntax near the keyword 'DECLARE'.
Msg 137, Level 15, State 1, Procedure...
Code not combining acct number results.
The code below returns for example:
74981995170968 1595.00 253.54 1341.46 940.40
74981995170968 1595.00 2281.86 3876.86 940.40
It should be:
74981995170968 1595.00 2535.4 1341.36 940.40...
How can I put an If statement saying If # RECORDS returned from the query below
IF # records returned is > 1 then
SUM(rmstranamt) AS rmstranamt10
ELSE
rmstranamt AS rmstranamt10
SELECT RMSFILENUM,
rmstranamt AS rmstranamt10 <-----If statement goes here base on if...
In this query, I get results
4313030999894992 85.00 3265.12 3180.12 3528.43
4313030999894992 178.31 3265.12 3086.81 3528.43
There should not be 2 values of 3265.12. Somewhere it's duplicating this and I don't know how.
If I run this query below:
SELECT rf.rmstrancde...
Let's say you have the following
Acct# Amount
1122 300
1122 300
1122 500
How do I write a SUM on Amount and tell it not to add both 300, just one of them with the 500? So basically I'm treating any amounts with the same value as one unique amount then adding it to...
For some reason, Sum rmstranamt is not being grouped and added together at the end, same for Sum rmstranamt 10:
SELECT rm.rmsacctnum,
SUM(rf.rmstranamt) AS [Sum rmstranamt],
SUM(rf10.rmstranamt10) AS [Sum rmstranamt 10],
CASE WHEN SUM(rf.rmstranamt) >...
The problem with my SUM below is that I don't want it to sum up like amounts. For example, there may be multiple rmstranamt showing but if in the list there are 2 that are alike, just sum up one of them along with the others. In other words, I need to somehow do a grouping of the rmstranamt so...
I can't get the syntax right on my nested CASE statements nor have I found anything on the web pertaining to nested SQL CASE statements:
SELECT rm.rmsacctnum AS [Rms Acct Num],
SUM(rf.rmstranamt) AS [TranSum],
SUM(rf10.rmstranamt10) AS [10Sum],
CASE WHEN...
I need to check SUM(rf.rmstranamt) for positive or negative
Rules should be:
If SUM(rf.rmstranamt) is negative
SUM(rf10.rmstranamt10) + SUM(rf.rmstranamt) AS [Balance]
If SUM(rf.rmstranamt) is positive
SUM(rf10.rmstranamt10) - SUM(rf.rmstranamt) AS [Balance]
instead of how I am just...
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.