Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 using > in SPROC

Author  Topic 

solent
Starting Member

33 Posts

Posted - 2005-11-03 : 07:16:53
hi all. i am new in these forums as well as in stored procedure programing. i was using ms access upto now so iam basically familiary with sql statements. here is my problem. I have this STORED PROCEDURE but when i try to save it i get this error Error 170: Line 13: Incorrect syntax near '>'. Anyone knows how can i use the > in a stored procedure as this one below.

CREATE PROCEDURE qry_investment_bond (@from_date as smalldatetime  ) AS

EXEC ('DELETE FROM dbo.tbl_tmp_investment')

INSERT INTO dbo.tbl_tmp_investment
(temp_ev_ccy, temp_ca_activ, temp_ca_astype, temp_ca_acct_no, temp_ca_asset, temp_ca_balance, temp_ca_bal_fx, temp_COUNTRY, temp_issuer,
temp_issuer_type, temp_FLOATING, temp_BOND_PD_RA, temp_BOND_PD_ST, temp_BOND_PD_EN, temp_LI_PERIOD_, temp_LI_PERIOD2,
temp_LI_PERIOD5, temp_MATURITY, temp_date, temp_date_flag)
SELECT dbo.tbl_investment.EV_CCY, dbo.tbl_investment.CA_ACTIV, dbo.tbl_investment.CA_ASTYPE, dbo.tbl_investment.CA_ACCT_NO,
dbo.tbl_investment.CA_ASSET, dbo.tbl_investment.CA_BALANCE, dbo.tbl_investment.CA_BAL_FX, dbo.asDump.COUNTRY, dbo.tbl_issuer.issuer,
dbo.tbl_issuer.issuer_type, dbo.asDump.FLOATING, dbo.asDump.BOND_PD_RA, dbo.asDump.BOND_PD_ST, dbo.asDump.BOND_PD_EN,
dbo.asDump.LI_PERIOD_, dbo.asDump.LI_PERIOD2, dbo.asDump.LI_PERIOD5, dbo.asDump.MATURITY,
@from_date, @from_date > dbo.asDump.BOND_PD_ST And @from_date <= dbo.asDump.BOND_PD_EN
FROM dbo.asDump INNER JOIN
dbo.tbl_investment ON dbo.asDump.ASSET = dbo.tbl_investment.CA_ASSET INNER JOIN
dbo.tbl_issuer ON dbo.asDump.ISSUER = dbo.tbl_issuer.issuer
WHERE (dbo.tbl_investment.CA_ACTIV = 'TRD' OR
dbo.tbl_investment.CA_ACTIV = 'LPTRD' OR
dbo.tbl_investment.CA_ACTIV = 'NTRD' OR
dbo.tbl_investment.CA_ACTIV = 'ORG' OR
dbo.tbl_investment.CA_ACTIV = 'LPORG' OR
dbo.tbl_investment.CA_ACTIV = 'NORG' OR
dbo.tbl_investment.CA_ACTIV = 'AFS' OR
dbo.tbl_investment.CA_ACTIV = 'NAFS' OR
dbo.tbl_investment.CA_ACTIV = 'LPAFS') AND (dbo.tbl_investment.CA_ASTYPE = 'BOND')

/* SET NOCOUNT ON */
RETURN


GO


anyway i know this can be done in ms access but i am not sure in a stored procedure. i googled it a lot but no lucky untill now. any help will be appriciated.

thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-03 : 07:35:21
all comparisons are done in your where part of sql statement.
like this:
where ... and @from_date > dbo.asDump.BOND_PD_ST And @from_date <= dbo.asDump.BOND_PD_EN

Go with the flow & have fun! Else fight the flow
Go to Top of Page

solent
Starting Member

33 Posts

Posted - 2005-11-03 : 08:35:48
thanks for the reply spirit1 i was going the wrong way about it but now i think i got it.

any idea how i can pass the from_date parameter from an ms access form?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-03 : 09:16:48
nope sorry... haven't worked with access in 3 years at least...

Go with the flow & have fun! Else fight the flow
Go to Top of Page

solent
Starting Member

33 Posts

Posted - 2005-11-03 : 09:22:37
thanks
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-11-03 : 09:45:16
You might want to ask that question over here:

http://www.sqlteam.com/forums/forum.asp?FORUM_ID=3

Is it and mdb or adp?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

solent
Starting Member

33 Posts

Posted - 2005-11-03 : 09:53:16
its adp

thanks ill have a look
Go to Top of Page
   

- Advertisement -