I have had a requirement to see a detailed information about a constraint on a table that includes table fields, type, rules, referenced table and fields for FOREIGN KEYs, etc. Found this useful TSQL to get such information: SELECT k.table_name, k.column_name field_name, c.constraint_type, CASE c.is_deferrable...
USE < database_name >; GO SELECT SCHEMA_NAME ( schema_id ) AS schema_name , o . name AS object_name , o . type_desc , p . parameter_id , p . name AS parameter_name , TYPE_NAME ( p . user_type_id ) AS parameter_type , p . max_length , p . precision , p . scale , p . is_output FROM sys.objects AS...
How many of you took help from using INFORMATION_SCHEMA views in SQL Server? Have you ever wondered in returning the informaiton of a Stored procedure or function, you may be thinking using SP_HELPTEXT would get you. Parts of the solution is yes with SP_HELPTEXT you can get but still there is lot more...
It seems often users want to check whether the data has only numbers in a varchar type column. The commonly suggested one is to make use of SQL Server's ISNUMERIC() function. But the problem in using that function is that it will treat some alphabets, $, char(10),etc as numbers. Consider this example...