Determine if a SQL table column has any unicode

Trying to reduce database-table-size by changing nvarchar to varchar where there is no unicode

http://answers.microsoft.com/en-us/ie/forum/ie9-windows_vista/only-secure-content-is-displayed/b5b31a5b-0b6f-4b6d-bf28-741ad30e9f37

SELECT TheColumn
FROM MyTable
WHERE TheColumn<>CONVERT(nvarchar(100),CONVERT(varchar(100),TheColumn))

SQL determine table row size

Personal note: See my SQL Monitor project


SELECT SCHEMA_NAME(so.schema_id) AS schemaname, OBJECT_NAME (sc.[id]) tablename
, COUNT (1) nr_columns
, SUM (sc.length) maxrowlength
FROM syscolumns sc
join sys.all_objects so on sc.[id] = so.[object_id]
--join sys.schemas s on so.schema_id = s.schema_id
WHERE so.is_ms_shipped = 0
GROUP BY so.schema_id, OBJECT_NAME (sc.[id])
ORDER BY SUM (sc.length) desc


SELECT SCHEMA_NAME(so.schema_id) AS schemaname, OBJECT_NAME (sc.[id]) tablename
, COUNT (1) nr_columns
, SUM (sc.length) maxrowlength
FROM syscolumns sc
join sys.all_objects so on sc.[id] = so.[object_id]
--join sys.schemas s on so.schema_id = s.schema_id
WHERE so.is_ms_shipped = 0
AND OBJECT_NAME(sc.id) = 'Orders'
GROUP BY so.schema_id, OBJECT_NAME (sc.[id])
ORDER BY SUM (sc.length) desc


dbcc showcontig ('Production.Orders') with tableresults

Table space used


EXEC sp_spaceused 'Product.Operations'

Make changes to an SQL Server Table without table re-creation

 

http://www.mssqltips.com/sqlservertip/1903/best-practices-for-sql-server-database-alter-table-operations/