data

SQL Server: How do I pull the ASCII value for each character in a column name?
This is a handy script to cycle through every character in a column to determine what each ascii value is. This is especially useful when a string match isn't matching. Often times, there is a hidden space, etc. DECLARE @counter int = 1;--DECLARE @asciiString varchar(10) = 'AA%#& '; DECLARE @asciiString varchar(100) SELECT @asciiString = [ColumnName] FROM schema.TableName where ColumnName like '%Something%'WHILE @counter <= DATALENGTH(@asciiString) BEGIN SELECT CHAR(ASCII(SUBSTRING(@ascii... ......

Posted On Tuesday, February 27, 2018 5:22 PM | Comments (1)

How do I set a trace in SQL Server?
Think of this as a lightweight alternative to SQL profiler. Under the hood of SQL profiler, there exists SQL Trace -- which provides a collection of stored procedures to generate trace info. Cut and paste the t-script below to see how it works.-- Pay attention to what the server settings for traces look like first:select * from sys.tracesgo-- you are looking to make sure there isn't already a trace file set somewhere-- In any case you will need to create a new trace, make sure the @tracefile doesn't ......

Posted On Friday, May 15, 2015 7:31 AM | Comments (0)