Insert an md5 password in mssql
Tech-Today

Insert an md5 password in mssql


To md5 a string in mssql we execute this query:

select HASHBYTES('MD5', 'password')

//But this has a problem because it returns a VarBinary data type which is a garbled text. So it should be converted first to NVarchar:
SELECT CONVERT(NVARCHAR(32),HashBytes('MD5', 'password'),2)

//To insert in the database
insert into Users (username, password) values ('user', (SELECT CONVERT(NVARCHAR(32),HashBytes('MD5', 'password'),2)))




- How To Change Varchar To Nvarchar In Mssql Using Hibernate
In my recent assignment I was asked to change how hibernate creates a table changing varchar fields to nvarchar. The problem is in MSSQL we need an nvarchar to support UTF-8 characters. We are actually using a JDBC MSSQL driver available here: http://technet.microsoft.com/en-us/library/ms378422.aspx...

- The 'system.web.security.sqlmembershipprovider' Requires A Database Schema Compatible With Schema Version '1'.
Normally you will encounter this issue if you generate an sql script of an aspnet_database without including the data. To resolve this you have 2 options: 1.) Execute c:\windows\microsoft.net\framework\v4.xxx\aspnet_regsql.exe, and just follow through....

- Create A Primary Key Column With Sequence Generated Value In Hibernate
For example you have a class User: package org.kalidad.seamexercises.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.SequenceGenerator; ...

- Mssql Get The Date From Datetime
...

- Sqlce Get Last Insert Id, Convert Sqldecimal To Int32
Platform: Windows Mobile, SqlCE2.0 Problem: You want to get the id of the last query you insert. Solution: Using the @@identity you have to execute your queries like this: SqlCeConnection conn = null; try { conn = new SqlCeConnection(GetConnection());...



Tech-Today








.