Maintenance and Management

Technical Article

detect different datatypes

  • Script

-  a simple and handy script that finds what differences might exists between the fields in your database that have the same name.I was wondering why my execution plans where different  for tables with the same  field names and the same indexes,statistics etc... because the syetem was converting my fields in the WHERE statement. -  […]

You rated this post out of 5. Change rating

2003-06-08

104 reads

Technical Article

How to get ColumnNames, datatypes and length

  • Script

This is a followup to the script submitted by srallapalli. One can return a record set of all tables in a database using the following:USE MyDatabaseSELECT so.name AS TableName, sc.name AS ColumnName,  st.name AS ColumnDatatype,  convert(int, sc.length) AS ColumnLength FROM syscolumns sc, sysobjects so , systypes st WHERE so.type='U' AND OBJECTPROPERTY(so.id,'ismsshipped') = 0 AND sc.id=so.id […]

You rated this post out of 5. Change rating

2003-05-10

142 reads

Technical Article

truncate logs regularly

  • Script

It is a painful experience for all us administrators to truncate logs regularly. I just created a job to executesp_msforeachdb "use ?; backup log ? with truncate_only ; dbcc shrinkfile(2,5)"on all the servers at frequent intervals. It has saved me a lot of time. hope it helps you too.n.b: I assume that file id 2 […]

You rated this post out of 5. Change rating

2003-04-18

316 reads

Technical Article

Get the Foreign Key Hierarchy 2

  • Script

This procedure is just another approach for getting a list of tables defined in a database, ordered by dependency on other tables based on foreign key relationship.I used it for a deployment process, where the TABLE create scripts must be executed in the correct order,because the foreign key constraints are specified in the create script […]

4.5 (2)

You rated this post out of 5. Change rating

2003-04-18

371 reads

Blogs

A New Word: Mornden

By

mornden – n. the self-container pajama universe shared by two people on a long...

SQL Training: Black Friday Deals Up to 75% Off

By

This Black Week, don't just get a discount—get ahead! Whether you're a total newbie...

How to find free space in Azure PosgreSQL

By

I wanted to figure out how big (or approximately how big) my dump file...

Read the latest Blogs

Forums

Announcing SQL Server 2025

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Announcing SQL Server 2025

Running Steve's Code

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Running Steve's Code

New SQL Server 2022 Functions

By Steve Jones - SSC Editor

Comments posted to this topic are about the item New SQL Server 2022 Functions

Visit the forum

Question of the Day

Running Steve's Code

Can you run this code in any of your SQL Server 2019 databases without error?

CREATE OR ALTER PROCEDURE [dbo].[StevesAmazingProc]
AS
    
        SELECT Consumer_ID ,
               Trend_Category ,
               Bit_Trace
        FROM    NewWorldDB.dbo.MarketTrend;
    
GO

See possible answers