July 8, 2010 at 10:32 pm
I use the T4 template processor provided freely in VisualSudio for this. It is much more flexible and easier to read. Also, I can point it to a whole database of tables or a set of tables and generate a whole wad of stored procs. Here is an article about it: http://www.olegsych.com/2008/01/how-to-use-t4-to-generate-crud-stored-procedures
July 9, 2010 at 2:14 am
Thank u.it's very very useful & time saving for the developers.
July 9, 2010 at 4:04 am
Deepthi Viswanathan Nair (7/22/2009)
Comments posted to this topic are about the item <A HREF="/articles/Stored+Procedures/67055/">Dynamic creation of Insert, Update, Delete Stored procedure</A>
I found an error when column type is NVARCHAR.
ex. nvarchar(255)
----> used your store procedure the datatype become nvarchar(510)
July 9, 2010 at 7:27 am
Very ingenious, but honestly, the proliferation of procs isn't a good thing.
This is better handled as others have said in client code where one class can dynamically generate all the needed code at run time.
This avoids all types of issues and allows you to keep all the code in the same place - business logic, data validation, etc.
Still, it is very ingenious, I just think less effort would be involved in the long run by keeping such code out of the database.
July 9, 2010 at 8:24 am
Yall should check out MyGeneration. They have a huge repository of scripts to generate anything for any language.
http://www.mygenerationsoftware.com/templatelibrary/default.aspx
July 9, 2010 at 8:31 am
I appreciate the thought and effort, but this is technology from 8+ yrs ago.. use an ORM and focus on value-added customer functionality
July 9, 2010 at 10:54 am
I understand why people write these utilities, but Microsoft changes system tables and relations between objects with every release. Utilities like this can become quickly out of date, and if deployed into some sort of production automation could cause problems on an upgrade.
July 9, 2010 at 11:10 am
Should look into using n-hibernate tool such as CSLA, LLBLGen Pro, etc... The CRUD procedures should reside in the DataAccessLayer.dll.
July 10, 2010 at 2:07 pm
The other thing that is missing is any code to handle decimal and numeric datatypes with Precision and Scale.
July 11, 2010 at 11:00 am
Hi
Great effort in getting out this procedure but what about decimal(p,s) that doesn't seem to reflect either.
July 11, 2010 at 12:22 pm
You could try this forum link:
http://www.sqlservercentral.com/Forums/Topic892846-391-1.aspx#bm901179
Regards
July 14, 2010 at 12:36 pm
This is AWESOME! Thank you!
July 15, 2010 at 7:10 am
to check your decimal(p,s) you can do this :
CaseWhen systypes.xusertype =106 Then '(' + Convert(varchar(10),syscolumns.xprec) +','+Convert(varchar(10),syscolumns.xscale)+')'
July 24, 2010 at 9:46 am
Eric_AZ (7/14/2010)
This is AWESOME! Thank you!
Hi,
Just wondering if you mean the SSCodeGen software to generate code, from the forum link before your reply, or this article for dynamic sql?
Viewing 15 posts - 31 through 45 (of 49 total)
You must be logged in to reply to this topic. Login to reply