Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Header Validation of an uploaded file

Status
Not open for further replies.

VIJSQL01

Programmer
Oct 30, 2010
74
US
hi,

I have a stored procedure in SQL 2008 which does certain calculations based on business rules. In order to do the calculations, we need to supply data in the form of file in .csv format. As of now, the stored procedure is unable to process the data, if the data file has a header.

My request is, is there a way we can handle this situation by implementing some validation checks in the beginning?

I mean check the column header for the required format, and if the format doesnt matches, give an error message saying calculation is not applicable.

Can we do like this? Please let me know. This helps me a lot.

Thanks,
VIJSQL.
 
Well, how about checking the files before processing them in a stored procedure? I'm quite confident it can be done in T-SQL, if all else fails by error handling, but I would do it before feeding the sql server, anyway, because any multiple purpose language (C/C++/C#/Java/VB/PHP whatever) is better in file processing and could rewrite the CSV file without the first line.

Why don't you ask your question in the forum183?

Bye, Olaf.
 
hi,

thank you very much. Per your suggestion, i will raise this question in programming forum with few additional questions.

Regards,
VIJSQL01
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top