Uncategorized

Policy Based Management and BCP

New SelecTViews Show Available!
More, smaller databases? Manage your checklists, our featured blog of the week for business intelligence…Also, the hotmail outage and SQL Server, 3rd party tools and more.
[Watch The Show Here]

Featured Article(s)
Improving .NET Application Performance and Reliability with Managed Database Connectivity (Part 1 of 3)
Whether your .NET applications are built using C# or VB.NET, it is highly likely that they rely on a relational database such as SQL Server, Oracle, DB2 or Sybase. This session will explore how developers can improve the performance, reliability and security of .NET application using ADO.NET providers that are 100% managed. Further, the session will provide practical information on how to leverage the Common Language Runtime (CLR) within the Microsoft .NET Framework to ensure 100% managed code performs well, scales effectively and is reliable and secure.

Policy Based Management and BCP
Did you ever wish you had standards applied to all your databases on all of your servers.? If you did, it would make it easier to find things or troubleshoot problems. The more people you have working on your servers and databases, the more differences occur in how things are done. The intention with standards is not to make everyone a clone, or to take the creative processes away from people. The goal here is to have some standardization so everyone can work effectively and efficiently.

SQL Server 2008 has a pretty rich feature set of Policies you can define on your servers and databases. There are very few things in SQL Server for which you cannot define a policy. Here are a few policy examples:

  • All Tables start with the prefix tbl_
  • All backups to disk are stored in the directory…
  • No database is allowed to AutoShrink Files
  • All databases automatically update statistics
  • Only user n may add new SQL Server accounts
  • All Indexes Must Disallow Page Locks

These aren’t recommended Policies…just trying to get a variety of possibilities demonstrating the kinds of things that could be done. Most user definable properties in SQL Server are exposed (meaning hundreds) allowing you to establish a lot of standards.
This may not be the best world if you have a lot of canned systems. But for those of you who are building your own databases this may be an option to help standardize your shop.

If you want to use Policy Based Management, you can find it in the SQL Server Managment Studio object explorer under Managemnt. Here is a link to a quick review of Policy Based Management to get you started.

Drop me a note with any standards or policies you have found useful in your experience…send your comments to btaylor@sswug.org.

BCP Responses
I did receive a couple responses regarding simply data transfer using BCP. Before I share one, I would like to make a correction to the Syntax I posted for BCP; I combined the parameters with the parameters from SQLCMD. BCP does not support a -d [Database] flag. Instead, the BCP command must use a fully qualified table object to import or export.

BCP database.owner.table/view IN/OUT Source/Destination file [other flags]

Daniel Writes
I like using vbscript… I have a collection of code snippets that allow me to log to windows, persist or populate data in a database , bring in data in binary or flat file format that can be richer then what a standard BCP command can handle… But as you say, it is old but still fully predictable…

Cheers,

Ben