Does anyone know how to parse SQL Text with VB.NET?
Ex: I got a sql file “CREATE TABLE…” i want to get an array of columns and an array of data types.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Expanding on @Tomalak’s post: once you have the table built you can use a DataReader to select just 1 line if you only need the schema or your actual data, then do something like this:
The collection myColumns will now have a
Keyof the column’s name and theValueis the columns datatype. You can modify this to make 2 separate collections if you need.Parsing a string on the other hand will involve significantly more debugging and offer lots of room for error.