I have an sql statement with if statements that when run from an sql client works but when run from c# it seems to miss out the if statements.. has this happened to anyone before?
here is th stored proc, it is not evaluating the first if statement properly. I have tried loads of different ways of doing the same thing but no joy. -
create procedure NewSingleRedemption
-
-
-- Input vars --
-
-- return var...
-
@action_id int output,
-
-
-- for Action table...
-
@RedemptionDate date,
-
@ActionType varchar(30),
-
@Origin varchar(20),
-
@PaperStatus varchar(30),
-
-
-- for RedemptionAction table...
-
@ReceivedDate datetime,
-
@ShortCode varchar(20),
-
@Amount float,
-
@AmountType varchar(20),
-
@disregardDeferredAmt bit,
-
@BaseDate varchar(11),
-
@Waiver float
-
-
-
-
-
as
-
begin
-
-- first check to see if user has set the action id to -1 from flosuite which
-
-- would indicate if they have selected to continue from the GUI
-
-
if action_id <> -1
-
--check to see if similar redemption exists
-
select @action_id=0
-
select @action_id=action_id from v_RedemptionAction
-
where ShortCode=@ShortCode
-
and RedemptionDate=@RedemptionDate
-
if @action_id <> 0
-
begin
-
select @action_id = -@action_id
-
select @action_id
-
return
-
end
-
end
-
-
-
begin tran
-
-- Internal vars --
-
-
-- for Action table...
-
declare @updateDate datetime
-
declare @type_id int
-
declare @status_id int
-
-
-- for RedemptionAction table...
-
declare @sub_id int
-
declare @fund_id int
-
declare @investor_id int
-
-
-- Set any NULL vals
-
if @BaseDate = 'Jan 01 1900'
-
SELECT @BaseDate = NULL
-
if @BaseDate = 'Dec 31 1900'
-
SELECT @BaseDate = "max"
-
if @Waiver = 0
-
SELECT @Waiver = NULL
-
-
-- Get sub_id and investor_id for short code --
-
SELECT @sub_id=subscription_id, @fund_id=fund_id, @investor_id=investor_id FROM Investor..Subscription
-
WHERE name = @ShortCode
-
-
-- Get other data --
-
SELECT @updateDate=getdate()
-
SELECT @type_id=type_id FROM Investor_nf1..ActionType WHERE description = @ActionType
-
SELECT @status_id=status_id FROM Investor_nf1..ActionStatus WHERE description = @PaperStatus
-
-
-- Insert record into Action and get action_id --
-
INSERT INTO Investor_nf1..Action (updateDate, actionDate, type_id, origin, parent_id, status_id, completedDate)
-
VALUES (@updateDate, @RedemptionDate, @type_id, @Origin, NULL, @status_id, NULL)
-
SELECT @action_id=@@identity
-
-
-- Insert into RedemptionAction --
-
INSERT INTO Investor_nf1..RedemptionAction (action_id, fund_id, investor_id, sub_id, requestReceivedDate, amountRequested,
-
amountType, percentBaseDate, disregardDeferredAmt, previouslySatisfied, amountRedeeming, amountDeferred, waiver_id,
-
investorGateInvoked, capitalInclusionGateInvoked, portfolioCompanyGateInvoked)
-
VALUES (@action_id, @fund_id, @investor_id, @sub_id, @ReceivedDate, @Amount,
-
@AmountType, @BaseDate, @disregardDeferredAmt, 0, NULL, NULL, @Waiver,
-
0, 0, 0)
-
-
-- Return value --
-
SELECT @action_id
-
-
commit tran
-
end
-
0 928 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ashish |
last post by:
Hi,
I am using PHP 4.2.3 and Sybase 12.0
I want to insert records in multiple tables in a database.
I also want to use transactions so that I can rollback in case there
was a problem.
I...
|
by: Ilya Knizhnik |
last post by:
I was wondering how to connect to postgresql and sybase databases.
I'm assuming that I need to recompile php with the flags for both
Do I also need to install sybase and postgresql themselves...
|
by: David Rysdam |
last post by:
What module is most recommended for accessing Sybase from Python? This
one: http://www.object-craft.com.au/projects/sybase/sybase/ ?
Also, is there any module that provides a generic DB API and...
|
by: jamilah |
last post by:
I am on windows xp, have installed sybase client, what driver do i
need for tcp/ip connection to sybase12 sql server?
For odbc, I only have Microsoft sql server driver Version
2000.81.9042.00
|
by: sleepite |
last post by:
If I configure PHP with:
../configure --with-mysql --with-apxs2=/www/bin/apxs --with-sybase-ct=/usr/lo
cal/freetds --enable-track-vars --with-xml --with-zlib-dir=/rpms/zlib-1.2.3
--with-png...
|
by: bala |
last post by:
hi access guru's
there is a requirement wherein i have to connect ms access frontend
with sybase (backend). the data from the frontend should be saved in
the table in sybase databae thro...
|
by: xinhuanet.com |
last post by:
can you tell me how to connect to sybase database with vb.net? please give
me one
example.thank you!
|
by: Dan |
last post by:
I have compiled and installed sybase-.037 , the module to add sybase to
python. However, when I try to use it I get Import error:
/usr/local/lib/python2.3/site-packages/sybasect.so
undefined...
|
by: =?ISO-8859-1?Q?S=E9bastien_Sabl=E9?= |
last post by:
WHAT IS IT:
The Sybase module provides a Python interface to the Sybase relational
database system. It supports all of the Python Database API, version
2.0 with extensions.
The module is...
|
by: =?ISO-8859-1?Q?S=E9bastien_Sabl=E9?= |
last post by:
WHAT IS IT:
The Sybase module provides a Python interface to the Sybase relational
database system. It supports all of the Python Database API, version
2.0 with extensions.
The module is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |