• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WITHOUT STORED PROCEDUREs

 
Prithiraj Sen Gupta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using a stored Procedure in SQL server. Area is a Table. It has two coloumns Area_Name and Area_Code(Primary Key, AutoGenerated keys). I am inserting "name of the Area" as . If the Similar Area name is pre existing in the table the value will never get inserted and the Store Procedure will return 1, else the Area Name will get Inserted and the Procedure will return 0.

I handle these data returned data and Put the validation codes in the Front End.

But I will use SELECT SQL STATEMENTs as I am migrating the server form SQL server to MS ACCESS. How should I implement similar logic in SELECT SQL statements.

The stored Procedure is in SQL SERVER.


Thanks & Regards

Prithiraj Sen Gupta
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But I will use SELECT SQL STATEMENTs as I am migrating the server form SQL server to MS ACCESS.

My sympathies.

Your logic looks pretty simple. I'd suggest just moving it into you application itself. You can use a select statement to find out if your area_name is already there, and a simple conditional to control what happens thereafter.

One thing that springs to mind is this procedure looks like it is manually enforcing a unique constraint. If your data model requires this, why not just define a unique constraint on area_name?
 
Prithiraj Sen Gupta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul,

I am successful in connecting my application with Access Database and translated all the stored procedure in ad-hoc way. That was a very easy way. But one thing I wanted to share that, in stored procedure of SQL server I have used "INNER JOIN" but in ad-hoc I used "JOIN". The SQL server did the same for both the type of statements. I hope my-sql and Oracle will do the same. But in MS Access The "JOIN" statements do not work as it shows ERROR in FROM Clause. But it worked well with INNER JOIN. Not only this Access have a different way of joining three tables.


Thanks & Regards
Prithiraj Sen Gupta
[ May 21, 2007: Message edited by: Prithiraj Sen Gupta ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic