|
Knowledge base
|
|
|
|
|
|
|
|
 |
|
 |
|
| Using SMO with SQL Express SMO is the new management model for SQL Server 2005, its included for use with SQL Express. |
| Getting Started with SMO in SQL 2005 In this series of articles, I'll demonstrate how to use SMO (SQL Management Objects) to do a variety of common DBA tasks including Backups, Restores,Index Maintenance, Integrity checks and more. These are some of the operations available in the SMO database maintenance utility available on this site - ExpressMaint. In this article we will concentrate on how to build a SMO application and how to connect to a SQL Server and retrieve some server properties. Example code will use VB.NET and C# as well as VBScript. For those of you that don't have access to Visual Studio 2005 Beta 1 I'll include the command line compiler commands. It may be easier to get started using VBScript as this is the simplest way to develop a quick SMO application. I'd also highly recommend the SMO sample applications that are part of the SQL Server Engine samples that come with SQL2005 Beta 2 and are also available for download for Express users here. |
| SQL Server 2005 Books Online Application programming interfaces (APIs) are the mechanisms used by applications to access resources on the local computer or available through a network. Microsoft SQL Server 2005 supports several classes of APIs that applications can use to access SQL Server resources. |
| How to configure SQL Server 2005 to allow remote connections When you try to connect to an instance of Microsoft SQL Server 2005 from a remote computer, you may receive an error message. This problem may occur when you use any program to connect to SQL Server. For example, you receive the following error message when you use the SQLCMD utility to connect to SQL Server:
Sqlcmd: Error: Microsoft SQL Native Client: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
This problem may occur when SQL Server 2005 is not configured to accept remote connections. By default, SQL Server 2005 Express Edition and SQL Server 2005 Developer Edition do not allow remote connections. To configure SQL Server 2005 to allow remote connections, complete all the following steps: |
| 'Kick-Start' Data Models Here are about 450 very useful 'Kick-Start' Data Models that I have created since I started 5 years ago, and here's the Top 20
If you would like an Access Database for any of these Models, email me at dba_requests-at-myway.com, simply replace -at- by an @ sign, and put the Database name in the Subject.
|
| The Curse and Blessings of Dynamic SQL In this article I will discuss the use of dynamic SQL in stored procedures and to a minor extent from client languages. To set the scene, I start with a very quick overview on application architecture for data access. I then proceed to describe the feature dynamic SQL as such, with a quick introduction followed by the gory syntax details. Next, I continue with a discussion on SQL injection, a security issue that you absolutely must have good understanding of when you work with dynamic SQL. This is followed by a section where I discuss why we use stored procedures, and how that is affected by the use of dynamic SQL. I carryon with a section on good practices and tips for writing dynamic SQL. I conclude by reviewing a number of situations where you could use dynamic SQL and whether it is a good or bad idea to do it. |
|
|
|
|
|
|
|
|
 |
|
|
|
MS SQL Server specifics
|
 |
|
 |
|
| Why doesn't SQL Server allow me to separate DATE and TIME? Admittedly, this is one of the rare features that Access boasts over SQL Server. The ANSI-92 standard states that compliant database should support the following DATE/TIME datatypes:
DATE + TIME
DATE
TIME
Unfortunately, SQL Server only supports the first type of column, with the DATETIME (sub-millisecond accuracy) and SMALLDATETIME (minute accuracy) datatypes. If you only insert partial information (such as '10/31/2001' or '3:25 PM'), SQL Server will fill in the rest for you |
|
|
|
|
|
|
|
|
 |
|
|
|
SQL programming
|
 |
|
 |
|
| Introduction to Dynamic SQL (Part 1) One of the most common questions we get involves Dynamic SQL. We have some articles that cover it but none that really start with the basics. So Merkin sat down and wrote this introduction to dynamic SQL. Using dynamic SQL you can put a SQL statement inside a variable and execute that statement. It's what you have to do when you're trying to run Select * from @TableName. |
| Passing an array of values to SQL Server (Stored Procedure) without parsing/string manipulation If you are splitting a CSV that just contains numbers, for instance surrogate key id’s that you are passing in because of a multiple select checkbox or something and you know the values range then why split the string? It’s simpler than that – no splitting required, just use dynamic SQL and an IN coupled with a numbers table... |
| The Curse and Blessings of Dynamic SQL For all three examples you can expect someone to answer Use dynamic SQL and give a quick example on how to do it. Unfortunately, for all three examples above, dynamic SQL is a poor solution. On the other hand, there are situations where dynamic SQL is the best or only way to go |
| Dynamic Search Conditions in T-SQL A very common requirement in an information system is to have a function (or several functions) where the users are able to search the data by selecting freely among many possible criterias. This is a tough challenge, because not only must you produce the desired output, but you must also keep the response time within acceptable limits, at least for common searches. And on top of all, the code must be maintainable, so you can meet new needs and requirements |
| SQL Server Management Objects: Lessons from the Wild Prior to SQL Server 2005, Microsoft's SQL Distributed Management Objects (SQL-DMO) offered the most efficient way to manage SQL Server programmatically. SQL-DMO supported a COM-based interface that you could use to discover and manipulate SQL Server objects. With SQL Server 2005 Microsoft provided a new management framework called SQL Server Management Objects (SMO) that provides more extensive management capabilities neatly bundled into a .NET Framework 2.0 assembly. While you can still use SQL-DMO to manage parts of SQL Server 2005, SMO provides more capabilities, supports most new features in SQL Server 2005, and is optimized for better performance.
|
| Enumerating SQL Servers Continuing with the discussion on enumeration, I will go over ways to enumerate active SQL servers on the network in this blog. Pre-Whidbey, to get list of active servers on the network, we could have done Inter-Op calls to server enumeration APIs in OleDb. If we wanted to write only managed code,we could have broad-casted a carefully crafted UDP packet to the network on port 1434 and waited for response from active SQL Servers and then list them.
In Whidbey, there is an API provided to do the server enumeration. It allows to list active servers on the network.
|
| Enter Null Values for DateTime Column of SQL Server Inserting a null value to the DateTime Field in SQL Server is one of the most common issues giving various errors. Even if one enters null values the value in the database is some default value as 1/1/1900 12:00:00 AM |
|
|
|
|
|
|
|
|
|
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
|
|
|
|
|
|
|
|