MyGeneration questions.

I have been using the MyGeneration's Build inserts from Table template for quite a while and find it extremely handy. I am now trying to expand the template to accomplish some additional tasks. Most I have been able to figure out by looking at other templates and the documentation, but there is one that is giving me trouble. I was wondering if someone could just give me a nudge in the right direction.

The problem is that I dont know how to distinguish SQL functions from SQL procedures in code. I have implemented code to pull the procedures for the selected db, drop each procedure, and recreate it. However, I have noticed that functions get lumped in with stored procedures and I end up with statements like: DROP PROCEDURE <Function Name> which of course cause SQL Server to choke. Is there a property I can look at to help me distinguish between procedures and functions or a way to pull only the procedures and pull the functions separately?

Also, two other lesser questions:
Is it possible to script SQL Server jobs in MyGeneration?
Is it possible to script SQL Server logins & their associated DB users in MyGeneration?
pureautoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pureautoAuthor Commented:
Oh, and one other question.  How can I edit the template source on the "Build Inserts from Table" template to allow SQL Server image types?
0
pureautoAuthor Commented:
Ok, I apologize.  One last question: When grabbing the procedures for scripting, how do I filter out system sprocs?

If anyone can help with ANY of these questions, I would greatly appreciate it.
0
ralmadaCommented:
>> how to distinguish SQL functions from SQL procedures in code.<<
So from sys.objects you can distinguish Functions from Stored procedures from the type column. For instance:
To list all functions:
SELECT * FROM sys.objects WHERE type in (N'FN', N'IF', N'TF', N'FS', N'FT')
To list all procedures:
SELECT * FROM sys.objects WHERE type in (N'P', N'PC')
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

pureautoAuthor Commented:
I think you missed something.  I am using a code generator called "MyGeneration" it is in MyGeneration code that I am trying to do this.
0
ralmadaCommented:
pureauto:
I understand that MyGeneration will eventually create a T-SQL script. So I'm just telling you how to distinguish a function from a procedure. So my question to you is: Why don't you just modify the T-SQL script accordingly?
If you have trouble modifying the script, then post a more specific question as Brandon has already suggested.
Thanks.
0
pureautoAuthor Commented:
I suppose that would work, but would make the resulting code rather verbose.

I have decided to switch from MyGeneration to CodeSmith for code generation.  MyGeneration seems to be a dead project.
0
pureautoAuthor Commented:
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.