Scripts

Technical Article

Script all indexes as CREATE INDEX statements

this script will generate CREATE index statements for all indexes in the database;there are already scripts out there that script constraints for primary keys and unique constraints, which automatically create an index behind the scenes. but what about the other indexes?uncomment two statements in order to filter out primary keys and Unique indexes so you […]

4.22 (18)

You rated this post out of 5. Change rating

2006-03-17 (first published: )

29,283 reads

Technical Article

Business Time in Seconds Function

SQL Function to calculate number of business seconds between 2 datetime fields. Input Parameters: @startdate - Start Time (datatype DateTime) @enddate - End Time (datatype DateTime) @starthour - Start of Business Day (datatype DateTime) (Format: '1900-01-01 9:00:00') @endhour - End of Business Day (datatype DateTime) (Format: '1900-01-01 17:00:00') @workdays - Business Day string - Use […]

You rated this post out of 5. Change rating

2006-03-15 (first published: )

241 reads

Technical Article

User Defined Function for Padding Numbers

This scalar udf takes three parameters @Number INT, @Length INT, @Position CHAR(1) and returns a VARCHAR(50) string which pads @Number with zeros to the specified @Length either to the right or to the left, according to @Position ('L' or 'R').E.g. SELECT dbo.udf_PadNumber(5, 6, 'L') returns '000005' whereas SELECT dbo.udf_PadNumber(5, 6, 'R') returns '500000'. The function […]

You rated this post out of 5. Change rating

2006-03-13 (first published: )

158 reads

Technical Article

Another Script to Generate a DataDictionary

Based on Ramesh Kondaparthy's script (Script to Generate DataDictionary for Database, posted 8/5/2005), I made a few format changes and included a few more columns.I modified Ramesh's script so that I could copy the result and paste it into Word as the beginning of a Data Dictionary document. (Hint: Once you've pasted the result into […]

5 (1)

You rated this post out of 5. Change rating

2006-03-01 (first published: )

509 reads

Technical Article

Create property methods for fields using query

Probably, many of you know this trick, but I thought it might be useful to people who doesn't know it. This script, when run in query analyzer with text output selected, simply creates property methods code. This example is written for creating property methods for c#. But you can modify it for any language. The […]

You rated this post out of 5. Change rating

2006-02-28 (first published: )

162 reads

Technical Article

FormatDate 2 All languages

This scipt is inspired by FormatDate - Mimics the VB Format routine for date. But this script work actually only whith a english Server. I improved this by a language independant. I use 2 others functions to retrieve the Long and short month name.

You rated this post out of 5. Change rating

2006-02-27 (first published: )

201 reads

Blogs

SQL Server Quickie #48 – Azure SQL Managed Instance

By

Today I have uploaded SQL Server Quickie #48 to YouTube. This time I’m talking...

Spark Connect Dotnet November 2024 Where are we?

By

All Spark Connect Posts Introduction There have been quite a few changes in the last...

A New Word: Ochisia

By

ochisia – n. the fear that the role you once occupied in someone’s life...

Read the latest Blogs

Forums

Export database and tables no table data

By HeftSteady

Trying to move a database from one sql server instance to another on separate...

Package to Project model conversion

By blom0344

Hi All, With previous customer range we were always required to work in the...

Issue with DBMail

By richardmgreen1

Hi all   We've got 3 servers with the same setup for dbmail. They...

Visit the forum

Question of the Day

What's the Ceiling?

What do I get as the results from this code?

SELECT CEILING (999.999), CEILING (-999.999);

See possible answers