Is there any way to view whitespace in the query editor for SQL Server Management Studio Express 2005?

In case you still need to know how to do this. Edit the Registry Key in HKEY_CURRENT_USER: Software\Microsoft\Microsoft SQL Server\xx\Tools\Shell\Text Editor\Visible Whitespace Where xx is the version you have (90 is 2005, 100 is 2008) And set it to 1 to show. Or for SQL Server 2012 and up client tools it is also in … Read more

Row_Number() with union query

Try this: SELECT *, ROW_NUMBER() OVER(ORDER BY Id) ROW_NUM FROM ( select Id, VersionNumber from documents where id=5 Union all select Id, VersionNumber from versions where id=5 ) a order by VersionNumber desc TO filter by version number 5 use: SELECT * FROM (SELECT *, Row_number() OVER(ORDER BY versionnumber DESC, id) row_num FROM (SELECT id, … Read more

How to update data in one table from corresponding data in another table in SQL Server 2005

If the two databases are on the same server, you should be able to create a SQL statement something like this: UPDATE Test1.dbo.Employee SET DeptID = emp2.DeptID FROM Test2.dbo.Employee as ’emp2′ WHERE Test1.dbo.Employee.EmployeeID = emp2.EmployeeID From your post, I’m not quite clear whether you want to update Test1.dbo.Employee with the values from Test2.dbo.Employee (that’s what … Read more

Nested stored procedures containing TRY CATCH ROLLBACK pattern?

This is our template (error logging removed) This is designed to handle Paul Randal’s article “No such thing as a nested transaction in SQL Server” Error 266 Trigger Rollbacks Explanations: all TXN begin and commit/rollbacks must be paired so that @@TRANCOUNT is the same on entry and exit mismatches of @@TRANCOUNT cause error 266 because … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)