I tried to get the last-modified date for a table through the available columns of Microsoft SQL Server Management Studio but was shocked to find it was not available. Luckily I found this query on the web which will give you just that.
SELECT name, modify_date FROM sys.tables
Poking around I ran into an article that showed how to hash input or variables in SQL. It is very important to note that the output hash will vary depending on your input data type. So hashing nvarchar will give you a different result than hashing nchar.
Also please note that this sort of thing might be considered bad practice by some as it requires your user’s data to go through yet another connection (webserver to sql server) which might possibly be unencrypted and sniffed.
Here is the MSDN example almost verbatim:
DECLARE @HashThis nvarchar(4000);
SELECT @HashThis = CONVERT(nvarchar(4000),'some text');
SELECT HASHBYTES('SHA1', @HashThis);
Here is how I tested it though I don’t recommend you do it this way.
SELECT HASHBYTES('SHA1', 'password');
The following algorithms are available, unfortunately they vary by server year:
- SHA2_256 (2012 Only)
- SHA2_512 (2012 Only)