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
How to Attach and Detach Database.

SQL SERVER – T-SQL Script to Attach and Detach Database

August 24, 2007
Pinal Dave
SQL Tips and Tricks
SQL Backup and Restore, SQL Data Storage, SQL Scripts, SQL Server

Move a database to a new server in three steps: Detach Database with sp_detach_db, copy the data and log files, then attach it again with CREATE DATABASE.

Read More
SQL SERVER - 2005 - Use of Non-deterministic Function in UDF - Find Day Difference Between Any Date and Today

SQL SERVER – 2005 – Use of Non-deterministic Function in UDF – Find Day Difference Between Any Date and Today

August 23, 2007
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Error Messages, SQL Function, SQL Scripts

I always thought a non-deterministic function was not allowed in a UDF, but GETDATE() works in SQL Server 2005. My UDF finds the day difference from today.

Read More
A CSV file.

SQL SERVER – T-SQL Script to Insert Carriage Return and New Line Feed in Code

August 22, 2007
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL String

Add a carriage return with CHAR(13) and a New Line Feed with CHAR(10) in T-SQL. Handy for formatting output, dynamic SQL with GO, and saving user text.

Read More
A furnished room beside the same room drawn as an empty blueprint, showing shape without contents.

SQL SERVER – 2005 – Create Script to Copy Database Schema and All The Objects – Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects

August 21, 2007
Pinal Dave
SQL Tips and Tricks
Database, SQL Backup and Restore, SQL Constraint and Keys, SQL Cursor, SQL Download, SQL Function, SQL Index, SQL Scripts, SQL Stored Procedure, SQL Trigger

A step by step tutorial to create a T-SQL script that can copy database schema and all objects, like stored procedures, functions, triggers, tables and views.

Read More
SQL SERVER - Find Monday of the Current Week

SQL SERVER – Find Monday of the Current Week

August 20, 2007
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts, SQL Utility

Find Monday of the current week with one line of T-SQL: DATEADD and DATEDIFF with the week part and GETDATE() give you the date.

Read More
Three small plain wooden blocks and a single empty space arranged neatly on an oak tabletop.

The SQL Basics Almost Everybody Skips

August 19, 2007
Pinal Dave
SQL Tips and Tricks
Best Practices, Database, SQL Scripts, SQL Server

Revisit SQL basics that change query results: NULL logic, logical processing order, grouped filters, and the difference between two common counts.

Read More
A paper calendar with the last day of the month circled in red.

SQL SERVER – Find Last Day of Any Month – Current Previous Next

August 18, 2007
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Utility

Find the last day of any month with DATEADD and DATEDIFF. One script returns the last day of the previous, current and next month in SQL Server.

Read More
Previous 1 … 307 308 309 310 311 312 313 … 336 Next
  • Books
  • Testimonials
  • Privacy Policy

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