Sql Server replication requires the actual server name to make a connection to the server

I found the solution in the following link http://www.cryer.co.uk/brian/sqlserver/replication_requires_actual_server_name.htm thankful to Brian Cryer for his useful site Quoting from the link to avoid link rot: Cause: This error has been observed on a server that had been renamed after the original installation of SQL Server, and where the SQL Server configuration function @@SERVERNAME still returned … Read more

with(nolock) or (nolock) – Is there a difference?

There is no functional difference, but eventually the syntax without WITH will not work. This has been deprecated: select customer, zipcode from customers c (nolock) So you should be using this format: select customer, zipcode from customers c with (nolock) Not using the WITH keyword for table hints has been deprecated since at least SQL … Read more

Reporting Services permissions on SQL Server R2 SSRS

This did the trick for me. http://thecodeattic.wordpress.com/category/ssrs/. Go down to step 35 to see the error you are getting. Paraphrasing: Once you’re able to log in to YourServer/Reports as an administrator, click Home in the top-right corner, then Folder Settings and New Role Assignment. Enter your user name and check a box for each role … Read more

SQL Server stops loading assembly

Assemblies with EXTERNAL_ACCESS are, through some convoluted path, falling under the EXECUTE AS path. The problem appears when the ‘dbo’ cannot be mapped to a valid login. dbo’s login is the login with the SID the owner_sid value in sys.databases. Unless an AUTHORIZATION clause was used in CREATE DATABASE the owner_sid is the login sid … Read more

How to cast datetime to datetimeoffset?

Edit: Updated better answer for SQL Server 2016 SELECT ChangeDate, –original datetime value ChangeDate AT TIME ZONE ‘Eastern Standard Time’ AS ChangeDateOffset FROM AuditLog The AT TIME ZONE takes into account whether daylight savings was in effect at the time of the date being converted. And even though it says “Standard” in “Eastern Standard Time”, … Read more

How do I add a “last updated” column in a SQL Server 2008 R2 table?

To know which row was last updated, you need to create a new column of type DATETIME/DATETIME2 and update it with a trigger. There is no data type that automatically updates itself with date/time information every time the row is updated. To avoid recursion you can use the UPDATE() clause inside the trigger, e.g. ALTER … Read more