This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting of a database character beside a stopwatch

Leap Year in SQL Server: SQL in Sixty Seconds #004

February 29, 2012
Pinal Dave
SQL Video
SQL DateTime, SQL Function, SQL in Sixty Seconds, SQL Scripts

To find a leap year in SQL Server, ask EOMONTH for the last day of February. I tested the method against the divisibility rule for every year from 1 to 9999 and found no disagreement. The post also shows an inline function, the errors for invalid years and a one-line TRY_CONVERT test.

Read More
Gouache painting of a frog leaping across four lily pads on a pond, the last pad holding a red flower

Detect a Leap Year in T-SQL: Four Simple Ways

February 28, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

Detecting a Leap Year in T-SQL takes one rule or one date trick. This post tests four ways on SQL Server 2025: the calendar rule, EOMONTH, TRY_CONVERT and DATEDIFF. It shows that all four agree on 209 years, explains the century years that trip people up, and answers how leap years affect date math.

Read More
SQL SERVER - Identifying Guest User using Policy Based Management

SQL SERVER – Identifying Guest User using Policy Based Management

February 27, 2012
Pinal Dave
SQL Tips and Tricks
Best Practices, Policy Management, SQL Scripts, SQL Server

Can a policy catch a guest user left enabled in user databases? Here is a quick tutorial on identifying guest user access with Policy Based Management.

Read More
A harbor crane lowering a blue shipping container onto a truck trailer, its corners lined up with the locks

Moving Data Out of SQL Server in Open Formats

February 26, 2012
Pinal Dave
SQL Tips and Tricks
CSV, ETL, File format, JSON, SQL Server

Move SQL Server data into open formats such as CSV, JSON, and Parquet while preserving types, NULLs, encoding, and readable files.

Read More
Reset Window Layout.

SQL SERVER – A Cool Trick – Restoring the Default SQL Server Management Studio – SSMS

February 25, 2012
Pinal Dave
SQL Tips and Tricks
SQL Server Management Studio

Closed Object Explorer by mistake or moved windows around? Here is a cool trick for restoring the default SQL Server Management Studio window layout.

Read More
Gouache painting of a visitor with an access card entering a database doorway

Guest User in msdb: Keep CONNECT and Avoid Error 916

February 24, 2012
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Login, SQL Server Security, System Database

The guest user in msdb needs CONNECT permission for features that run under logins without a user there. I reproduced error 916 in a test database on SQL Server 2025, with a query to check guest in msdb and a way to list every database where guest can connect.

Read More
Guest user disabled.

SQL SERVER – Detecting guest User Permissions – guest User Access Status

February 23, 2012
Pinal Dave
SQL Tips and Tricks
SQL Server Security

Is the guest user enabled or disabled, and what is the default? I answer reader questions and show ways to detect guest user access status.

Read More
Gouache painting of a stone moving from an open envelope into a fitted compartment in a wooden sorting tray.

Declare and Initialize Variables in SQL Server: SQL in Sixty Seconds #003

February 22, 2012
Pinal Dave
SQL Video
SQL Datatype, SQL in Sixty Seconds, SQL Scripts, SQL Variable

To declare and initialize variables in one statement, give each variable a type and a starting value in the same DECLARE. The tests here show the NULL default, a loop that does not reset an uninitialized variable, and the one character varchar trap on SQL Server 2025.

Read More
Office desk at night with the lamp still on, a mug and a jacket on the chair, someone is still logged in

SQL SERVER – Force Removing User from Database – Fix: Error: Could not drop login ‘test’

February 21, 2012
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Scripts, SQL Server, SQL Server Security

Error 15434: could not drop login ‘test’ because the user is logged in. A reader ran my demo on production; here is my Force Removing User fix, no restart needed.

Read More
SQL SERVER - Disable Guest Account - Serious Security Issue

SQL SERVER – Disable Guest Account – Serious Security Issue

February 20, 2012
Pinal Dave
SQL Tips and Tricks
SQL Server Security

I like to disable guest account access in SQL Server unless there is a real need for it. Here is why the guest user can be a serious security issue.

Read More
Previous 1 … 385 386 387 388 389 390 391 … 593 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com