Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Script to Return a Transposed Data Row

By click-fund,

I often do the following when administering databases "select * from Table where PrimaryKey=value" and find the output in Query Analyzer is inconvenient to view when the table has many wide columns (which is often the case). This script returns a single entry from a table but "transposed" so that the data flows down the page not accross it. I know this sounds trivial, but it's convenient, so I thought I'd share it.

(Note: T-SQL doesn't support arrays, as far as I'm aware, so the code is a little ugly.)

Total article views: 221 | Views in the last 30 days: 2