| Author |
Topic |
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2010-06-16 : 05:31:55
|
I have a sql table with many, many fields. Is there an easy way to create insert and update stored procedures without having to type out all the parameters and all the fields and then all the values ? |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-16 : 05:36:08
|
Half the way is right click the table in object explorer and choose [Script table as] and then [Insert to] No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2010-06-16 : 05:39:50
|
| Thank you very much :-) - I never knew that before (self taught :-() |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2010-06-16 : 05:43:27
|
| Do I have to remove the ,< etc ?VALUES (<ACC_AccType_A, nvarchar(50),> ,<ACC_GHYY_A, bit,>...etc etc |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-06-16 : 05:53:05
|
| I have a Stored Procedure that queries the system tables and outputs all the code for our "standard" CRUD (Create, Read, Update, Delete) Sprocs, and a Trigger that hits the UpdatedOn column and saves the change to Audit Table.Took a while to write, but we use it on every table we create now, so saves lots of time in the long run.If we add a column we run the SProc to generate the SProcs to temporary files, then compare that against actual source code using a Programmer's File Diff too (which makes it easy to select changes to merge. Mostly the SProcs are unchanged from the mechanically-generated, so we can just MERGE-ALL - but those that have been hand-edited can be updated "selectively" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-16 : 05:56:31
|
quote: Originally posted by Pinto Do I have to remove the ,< etc ?VALUES (<ACC_AccType_A, nvarchar(50),> ,<ACC_GHYY_A, bit,>...etc etc
You need to remove everything after VALUES and give actual data for each columnMadhivananFailing to plan is Planning to fail |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-16 : 05:58:05
|
quote: Originally posted by Pinto Do I have to remove the ,< etc ?VALUES (<ACC_AccType_A, nvarchar(50),> ,<ACC_GHYY_A, bit,>...etc etc
They are placeholders and you can type in values for them using CTRL-Shift-M No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2010-06-16 : 05:59:48
|
| Thanks you Madhivanan. I can copy and paste those and edit them to create my parameters |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2010-06-16 : 06:05:45
|
| Webfred - my values are coming from an asp.net web page application |
 |
|
|
|