Learn SQL With Bru

Bru Medishetty's SeekWell Blogs

  • Home
  • SQL Server Forum
  • SQL Server Tidbits
    • SQL Tidbits Jun 2010
    • SQL Tidbits May 2010
    • SQL Tidbits Apr 2010
    • SQL Tidbits Mar 2010
    • SQL Tidbits Feb 2010
    • SQL Tidbits Jan 2010
  • SQL Server Interview Questions and Answers
    • SQL Server DBA QandA
    • SQL Server DEV QandA
    • SQL Server BI DEV QandA
  • About Me

Changing SQL Server Authentication Mode

Jul 17th

Posted by Brumedishetty in SQL Server

No comments

This article explains the procedure, how to change the authentication mode in SQL Server.

Authentication mode of a SQL Server instance is the deciding factor how the SQL Server authenticates the users and logins. SQL Server supports 2 authentication modes: Windows Authentication Mode & SQL Server and Windows Authentication Mode. There are advantages and dis-advantages in choosing these authentication modes, which will be covered in a seperate blog later. Let’s take a look at the steps to change the SQL Server Authentication Mode.

We start by right clicking on the SQL Server instance and choose Properties from the pop-up menu, as shown in the below image.

  

Then, SQL Server properties window is displayed. (as shown below).

 

Choose Security page in left pane of the dialog box. Now in the right side pane, in the top section (image below) you have the Server authentication section under that the 2 authentication modes are listed as an options, (at any point onnly one of them can be selected). Choose the appropriate authentication mode you would like the SQL Server set to and click OK.

 

The next step is to restart the SQL Server.

Comments / feedback will be highly appreciated.

– Bru Medishetty

 

Administration, Authentication, Security

Using WHERE Clause in SQL Server Query

Jun 25th

Posted by Brumedishetty in SQL Server

No comments

In this blog we shall look into the usage of WHERE clause in SQL Server. WHERE clause can be used in Select, Update, Delete statements to filter the rows being affected by the query. In fact it can be used inside an Insert statement too which has a Select statement. WHERE clause ensures the data is filtered when it is retrieved in select statements or it ensures only those records are affected when updating / deleting is performed.

A WHERE clause contains one or more conditions depending on which the records are filtered in the table(s). The conditions in WHERE clause can be based on one or more operators and the operators that can be used in a WHERE clause can be =, <>, != , >, <, BETWEEN, IN, LIKE, NOT and many more. When there are multiple conditions, those conditions can be combined with AND / OR.

Let us look at some examples to understand different types of WHERE clause.

Examples for WHERE Clause

Example 1: Using “=”

 

SELECT EmployeeID, Title, Gender, HireDate 

FROM AdventureWorks.HumanResources.Employee

WHERE Title = 'Production Technician - WC20'

In the above SQL statement, the condition used in WHERE ensure that those records that have the value “Production Technician – WC20″ in the Title column will be displayed. You might have noticed that the string value Production Technician – WC20 is enclosed in single quotes, the reason being that all string values and Date and time related columns need to compared with at value which is enclosed in single quotes.

Example 2 A: Using “LIKE” and %

SELECT EmployeeID, Title, Gender, HireDate 

FROM AdventureWorks.HumanResources.Employee 

WHERE Title LIKE '%Technician'

In the above SQL statement, the condition used in WHERE is more wider than the one in previous example. It uses LIKE keyword to filter those records that end with the value “Technician” in the column Title. Notice that when we use LIKE we do not use = symbol as we would like to filter the data according to a patterm matching and the criteria in this condition is any rows / records which end with the string Technician. You also notice that ‘%’ is used before the string, which indicates that any string value in that position is valid in the condition.

SELECT EmployeeID, Title, Gender, HireDate 

FROM AdventureWorks.HumanResources.Employee 

WHERE Title LIKE '%Technician%'

Example 2 B: Using “LIKE” and %

In this statement, the condition is little bit changed to that in previous example. It has an additional ‘%’ at the end of the expression, indicating that any record is a valid record which contains the string “Technician” in column Title, no matter if it is at the beginning or startig or the end of the string value.

Comments / feedback will be highly appreciated.

–Bru Medishetty

Scripts

Finding Log Size for all Databases in SQL Server

Jun 4th

Posted by Brumedishetty in SQL Server

No comments

Monitoring the size of Transaction Log files is one of those important tasks for a SQL Server Database Administrator. I monitor regularly in order to ensure that my database log files do not grow tremendously in size and potentially run out of space. The script in this article will give the list of Databases and their Transaction Log files size in MB in the descending order.

Script used in this blog…

SELECT INSTANCE_NAME AS [DATABASE],(CNTR_VALUE/1000) AS Size_In_MB
FROM MASTER.dbo.SYSPERFINFO 
WHERE COUNTER_NAME LIKE '%Log File(s) Size (KB) %'
AND INSTANCE_NAME NOT IN ('_Total','mssqlsystemresource')
ORDER BY Size_In_MB DESC 

 You may also take a look at one of my previous blogs related to transaction logs. Find Transaction Log Space Used

Comments / feedback will be highly appreciated.

–Bru Medishetty

Monitoring, Scripts, Transaction Logs
12345»1020...Last »
  • Search this Site

  • Site Stats

    859,316 Views (Since Nov 1 2009)

    Stats are not updated real time, they are updated as the server information is updated.

  • Site Visitors

    World wide visitors to this blog since May 14th 2010..

    Locations of visitors to this page

  • My Other Blogs

    • Beyond Relational My blogs @ Beyond Relational
    • Full Throttle My blogs @ SQLServerCentral
    • MSSQLTips My Articles List @ MSSQLTips
    • SQL Server Club My blogs @ SQL Server Club
  • Blogs Archive

    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
  • Tags

    .NET 3.5 2010 Access Administration Articles Backups Certification Charity configurations Deployment Downgrading Dynamic Mangement Views Error Logs General Goals High Availability Installation Linked Server Logging Monitoring MSSQLTips Multiple Instances New Features NULL Performance Tuning Personal Sample Databases Scripts Service Pack snapshots SQL PASS SQL Server SQL Server 2008 SQL Server 2008 R2 SSAS SSIS SSIS Warning Strings System Stored Procedures T-SQL Tips Transaction Logs Troubleshooting Tutorials Upgrade
  • Recent Comments

    • bHASKAR on SQL Server DBA QandA
    • Brumedishetty on Creating Primary Key in a SQL Server table
    • vru_sebe on Creating Primary Key in a SQL Server table
    • Ed Taylor on Choosing how the query result are displayed
    • Steve on Find SQL Agent Job name based on Activity Monitor
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top