Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


way to enforce object naming conventions?


way to enforce object naming conventions?

Author
Message
mbaldock
mbaldock
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 43
Hi,
i'm wondering if there is any way to enforce object naming conventions (using three-part identifiers) within views/functions/procedures ?

for example, use
insert into myBase.dbo.myTable

instead of
insert into dbo.myTable

or use
select * from myBase.dbo.myFunction()

instead of
select * from myBase..myFunction()



we have several sql2008 databases and several developers and although we have some (loose-ish) guidelines for naming conventions, they are not always adhered to.

i've read a little about policy-based management but i'm not clear if something like this can be achieved.

it seems to me the only way to ensure all developers adhere firmly to our naming conventions is to hold a staff meeting and drum it in to them!

perhaps someone could point me in the right direction ?

many thanks
anthony.green
anthony.green
SSCertifiable
SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)

Group: General Forum Members
Points: 6106 Visits: 6078
There is no way to enforce a naming convention when your typing code but you can enforce object names where you have to create a table using a prefix for example all tables need to start tbl, all views need to start vw but that would only come into force when you create the object, not when you reference it in script.

If you want to ensure your developers reference an object mydatabase.myschema.myobject then you will need to drum it into them that this is the way that things are done.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger


mbaldock
mbaldock
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 43
in the back of my mind i was hoping there was some simple way of coding it, but it looks like i'll be calling a meeting quite soon. ;-)
many thanks.
John Mitchell-245523
John Mitchell-245523
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7492 Visits: 15151
Are you sure you want to make that a universal rule? Bear in mind that if you rename your database, or if you like your code so much you decide to use it in a different database, you could end up having to do some serious refactoring.

John
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search