Scripts

Technical Article

Check for orphaned user or sid in syslogins

When rebuilding a server or setting up a backup or DR server the logins need to be added into master and synchronised with the user databases.Inevitably there are orphaned users is sysusers or the sid's do not match with syslogins.I use this stored procedure to check for a particular user when the user experiences a […]

You rated this post out of 5. Change rating

2002-03-07

808 reads

Technical Article

Pivot Data based on Unknown Field Items

I was posed a question a few months back on another site about being about to create a Pivot Table (Horizontal version of vertical data) and I saw the question again today. This will allow you to do that, just make changes to the query where the title is the replacement need. It will build […]

1 (1)

You rated this post out of 5. Change rating

2002-03-07

1,317 reads

Technical Article

Rows count for each and every table in a DB 

       By using this script one can find number of rows for each and every table in a database. Just cut and past this script in your DB and excute. A stored procedure will be created as 'Get_rowcounts_for_eachtable'. If U excuted this stored procedure, U can get all tablenames and rowcounts for respected […]

You rated this post out of 5. Change rating

2002-03-07

584 reads

Technical Article

Populate a table with a directory's file info.

I use this SP to return full directory information into a table.  FilePath, FileName, Filedate and FileSize are parsed from a 'dir /n/on/-c ' command. FilesInDir is the table created. usage: exec LoadFileDetailsIntoTable 'c:\winnt'select * from FilesInDir where filesize > 100000select min(fileDate) from FilesInDirThe Return Code will equal the number of files found.

You rated this post out of 5. Change rating

2002-03-05

458 reads

Technical Article

spAddField

spAddField is the proc I use to add all fields to the db in our upgrade scripts.  With this proc, you pass it the tablename, fieldname, datatype, and null or not null.  This will call spGetFieldsExists and see if the fields exists or not.  If it does, spAddField will drop that column.  Then it readds […]

You rated this post out of 5. Change rating

2002-03-05

216 reads

Blogs

Master the Foundational Basics

By

It tells us to take the time to master the foundational basics of whatever...

Simple Talks Episode 9–Data masking and subsetting

By

The episode on data masking and subetting is out. You can see it here:...

T-SQL Tuesday #180: Avoid Perfect for Good Enough

By

I'm listening to Effortless by Greg McKeon (link to author's page) through Audible.com. He...

Read the latest Blogs

Forums

ssrs order of operation question

By stan

hi i need "sample size" in my report's 4th data region which is a...

Query Network Protocols from T-SQL or PowerShell

By webrunner

Hello experts, I want to be more organized about the SSL certificates we have...

Occasional Sql Server 2019 slowness (upgraded from 2014) -- please help...

By jellybean

Hi everyone, We recently upgraded our server to Sql Server 2019 (15.0.2125.1 (X64) on...

Visit the forum

Question of the Day

The Hash Join I

What are the two inputs called to a hash join operation in SQL Server? (choose 2)

See possible answers