I have a piece of code which allows me to take a single string and parse it into columns. However I have no idea where to start with the export. The import is easy enough with a split and insert.
With the export I will need to select about 6 of the 12 columns in table A, combine all these files into a delimited list and then return the string.
I assume that the best way of doing this would be the following?:
- Create the export procedure
- Create a temp table(e.g. “temp”)
- DECLARE the values I want to export
- Insert into the “temp”, a delimited string with all the values (i.e. new row = “col1,col2,col3,col4”) (this is the part i’m not sure about)
- Somehow return this value from the stored proc?
I’m fairly comfortable using SQL to select, update, combine and other menial tasks… but I literally have no idea when it comes to stored procs as I always try to avoid them and add functionality into my code instead!
Try this…
You can cast or convert different datatypes using SQL. (Cast & Convert)
Here's a few examples: