DECLARE @SourceShipToID VARCHAR(20) IF (ISNULL(@SourceShipToID,''))='' SET @SourceShipToID ='NULLSourceShipToID' PRINT @SourceShipToID
Posts Tagged ‘T-SQL’
During recent debugging of T-SQL stored procedures, I found adding following
code in your catch block will help to point the actual cause of error and make your programming life much easy!
Begin Try Print 'Do Something' End Try BEGIN CATCH ROLLBACK TRANSACTION print 'Error Msg: ' + ERROR_MESSAGE() print 'Error Procedure: ' + ERROR_PROCEDURE() print 'Error Number: ' + convert(varchar(50),ERROR_NUMBER()) print 'Error Line: ' + convert(varchar(50),ERROR_Line() END CATCH
I was looking a query that tell me a list of view using certain view from a table, and found the answer here.
See the code below. Hope this could help someone somewhere.
select view_name from INFORMATION_SCHEMA.VIEW_COLUMN_USAGE where column_name='ColumnNameHere' and table_name='TableNameHere'