Tips for creating my first procedure

Hi there,

I'm new to SQLExp and have been writing some queries over the past few weeks on a database I'm developing.

I now want to assemble my queries into a procedure that I can schedule (which I understand has its challenges in Express but I'll work on that at a later date).

The queries I have are to do this;

- Bulk insert from txt files in temp table

- data adjustments

- integrity check

- insert into main table

At the minute I have these as 4 .sql files and not 100% clear on how to move this to a procedure. For e.g.

- Should I aim to consolidate my 4 .sql files into 1 or create a procedure that calls each of these. n.b. the 4 files need to be run in sequence

- Also, where will the procedure be stored? Inside the database it runs on or as a stand alone file like my .sql files

- Finally, since I have already written my sql is creating the procedure as simple as copy paste into the Management Studio or is there a better way?

thanks,

Bassmann

July 3rd, 2015 8:44pm

BULK INSERT TmpStList FROM 'c:\TxtFile1.txt' WITH (FIELDTERMINATOR = '","') is insert into table .

Refer     Try use SSIS will save your time.

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 10:41pm


At the minute I have these as 4 .sql files and not 100% clear on how to move this to a procedure. For e.g.

1.- Should I aim to consolidate my 4 .sql files into 1 or create a procedure that calls each of these. n.b. the 4 files need to be run in sequence

2. - Also, where will the procedure be stored? Inside the database it runs on or as a stand alone file like my .sql files

3.- Finally, since I have already written my sql is creating the procedure as simple as copy paste into the Management Studio or is there a better way?


1. Yes that is what procedure does and is used for to combine various code blocks into one

2. Procedures will be stored in respective database. If you expand database you see programability expand this and you would see stored procedure don't go into system Stored procs

3. I did not understand this

July 4th, 2015 1:10am

Thanks to all,

Have made good progress with your tips

Free Windows Admin Tool Kit Click here and download it now
July 4th, 2015 1:52am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics