0

How to check the filename exists in sybase Sql Anywhere11 and return error message if not in Sql Anywhere11?

I have a textbox and submit button in front end. So the user can enter the file path into the textbox and click submit.

The submit button call the procedure and i want to check in the beginning of the procedure weather the file exists or not and return some value if not exists.

Example:

D:/hello/world.csv is the path name.

So I need to check the D:/hello is a valid path and world.csv is exist in the specified path.

Thanks

Sri
  • 2,233
  • 4
  • 31
  • 55
  • Again Updated the question. Sorry. @michaelgardner – Sri Mar 25 '14 at 15:51
  • Those checks would likely be handled by your application, not the database. The database is there primarily to store/retreive data. The application is there to handle business logic, and interact with the Operating System. The database can check to see if those values are already stored, but won't validate that the values are valid. Here's an example of an existance check: http://stackoverflow.com/questions/11263680/sql-anywhere-11-check-if-event-exists – Mike Gardner Mar 25 '14 at 16:00
  • 1
    If you do want the database to handle those checks, you will likely have to use `xp_cmdshell`(http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.sqlanywhere.11.0.0/dbreference_en11/sysproc-s-4380894.html), which will allow you to call OS commands from within the database. Those OS commands could be used to validate the path/filename. – Mike Gardner Mar 25 '14 at 16:12
  • Thank you very much Michael. I added the checking condition in application and it seems to be working fine. Thanks @michaelgardner – Sri Mar 25 '14 at 17:39

0 Answers0