.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

SqlServer MD5

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :Sql Server
I'm useing sql2005,Why I have a different result with nvarchar and varchar datatype,the correct should be use varchar type Here is the code: --use nvarchar declare @smd5 char(34); declare @str nvarchar(6); set @str='111111' select @smd5=sys.fn_VarBinToHexStr(HashBytes('MD5', @str)) select Right(@smd5,32) as md5string --Result is 7066a40f427769cc43347aa96b72931a   --use varchar declare @smd5 char(34); declare @str varchar(6); set @str='111111' select @smd5=sys.fn_VarBinToHexStr(HashBytes('MD5', @str)) select Right(@smd5,32) as md5string --Result is 96e79218965eb72c92a549dd5a330112   Thanks  

View Complete Post

More Related Resource Links

How to Encrypt and Decrypt a Password using SQLSERVER 2005?(Video)

Encypt and Decrypt a Password using SQLSERVER 2005(Video)

Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions

Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.

SqlServer - Windows Account to install Application from Gallery


Referring to this tutorial: http://www.asp.net/webmatrix/tutorials/download-and-install-an-asp-net-application

I selected umbraco cms and got this wizard:

I already have Standard Sql Server 2005 on my machine which I wanted to us for above DB and not SqlExpress.

I did not remember "sa" account pwd nor I use explicitly any account to connect to my Sqlserver. I use Windows Authentication account i.e implicit authentication. So I created new account and gave all rights and used it in the above wizard and was able to install the database after some struggle.

My question is: What if I want to use my Windows Account to install the database above? Why the wizard don't have any option to use Windows Integrated Authentication?

Note: I can create the DB with external user I created, just looking specifics for using Windows Authentication for above installation.

Create excel file from Binary data on SqlServer



My requirement is that i upload an excel file then i need to validate that data.


1. Uploading file using using upload control saving binary in SqlServer

2. Then i am creating file from binary data  on Sql Server using below command and then using OPENROWSET to dump data to Sql table

3. Then reading Sql Table row wise and validating data.


Alter Procedure spUploadExcelFile
  @PKID int,
  @BatchID int


	Declare @VarBin varbinary(max)
	Declare @FileName varchar(100)
	DECLARE @sql nvarchar(MAX)
                DECLARE @errMsg nvarchar(MAX)
	DECLARE @ObjectReturn INT
	DECLARE @ErrorSource VARCHAR(255)
	DECLARE @ErrorDesc VARCHAR(255)
	DECLARE @ObjectToken INT

	Select @VarBin  = Content , @FileName = [FileName] from MultilangBinaryData Where PKID = @PKID
	SET @FileName = 'C:\'  + @FileName
	EXEC sp_OACreate 'ADODB.Stream' @ObjectToken OUTPUT
	EXEC sp_OASetProperty @ObjectToken, 'Type', 1
	EXEC sp_OAMethod @ObjectToken, 'Open'
	EXEC sp_OAMethod @ObjectToken, 'Write', NULL, @VarBin
	EXEC sp_OAMethod @ObjectToken, 'SaveToFile', NULL, @FileName, 2
	EXEC sp_OAMethod @ObjectToken, 'Close'
	EXEC sp_OADestroy @ObjectToken  
	SET @sql = 'INSERT INTO dbo.UserBulkData SELECT 0,NULL,'+ @BatchI

SQLServer 2008 Tools and SQL 2005 Cluster

I recently built a SQL Server 2005 cluster on the o/s Windows Server 2008 R2.  I have been attempting to connect to the cluster from my Windows 7 dekstop with my SQL Server 2008 Tool set.  I have been unable to attach to this cluster since its creation. The firewall is temp off, remote connections in the surface area configuration is set to pipes and tcp/ip and the Browser surface is up and running. I ran Wireshark against the cluster and I could see that there was UDP conversations for ms-sql-m (SQL Port) but that was as far as it would get.  I am using a named instance so not using 1433, but I do see the cluster offering up high RPC ports but the client never responds after the initial UDP response. When I noticed that there was a two way conversation taking place, I went to a seperate machine and fired up SQL Server 2005 Tools and I was easily able to attach to the cluster.  So my question is - Are there any known incompatibilities between SQL Server 2005 cluster services and SQL Server 2008 Tool set?  I can use my 2008 tools to attach to a non-clustered SQL Server 2005 w/o issue.   Error when attempting to connect: A network-related or instance-specific error occured while establishing a connection to sql server.  The server was not found or was not accessible.  Verify that the instance name is correct and the SQL Server is con

call c# class from sqlserver

Hi,How I can call a c# class from sqlserver

Could not load file or assembly 'Microsoft.SqlServer.BatchParser' or one of its dependencies

I got this problem when I tried to migrate one of my web deployment project from vs2005 to vs2010 on windows 7 machine. The exactly error message is like this: Could not load file or assembly 'Microsoft.SqlServer.BatchParser' or one of its dependencies. An attempt was made to load a program with an incorrect format.(description) ASPNETCOMPILER(file), myWebDeploy (project) I have installed all of suggested feature packs as suggested by others: SQLServer2005_ADOMD_x64.msi, SQLServer2005_XMO_x64.msi. Can somebody please help? Thanks a lot 

Microsoft.SqlServer.BatchParserClient, Version= -- Again it seems

Ok I created a project and installer, the project uses the SMO assemblies.  On my system and all my test seems it installs and works fine.  After installing on other system I am starting to get error reports because "Microsoft.SqlServer.BatchParserClient, Version=" is not installed on the system.  I have been doing some digging and found the below link but that only seems to help after the fact.  I need to include the correct assemblies in my installer.  Currently the package include the list below which does not include the problem file.  I tried installing SP3 on SQL 2005 but that does not seem to have helped.  What is the correct way of getting this assembly installed on the client server.  I am not happy with giving everyone the below link.http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=228de03f-3b5a-428a-923f-58a033d316e1 Packaging file 'Microsoft.ReportViewer.Common.dll'... Packaging file 'Microsoft.ReportViewer.WinForms.dll'... Packaging file 'Microsoft.SqlServer.ServiceBrokerEnum.dll'... Packaging file 'WPFToolkit.dll'... Packaging file 'Microsoft.SqlServer.SqlClrProvider.dll'... Packaging file 'Microsoft.SqlServer.SqlEnum.dll'... Packaging file 'Microsoft.ReportViewer.ProcessingObjectModel.dll'... Packaging file 'Microsoft.SqlServer.ConnectionInfo.dll'... Packaging fil

What happened to the backup and restore classes in namespace Microsoft.SqlServer.Management.Smo vers

I do not see these two classes in version 10 of this namespace and I am not finding any documentation explaining what happened to them.

Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=

Hello to everyone. I have a .exe which uses the Server Management Objects(SMO) When I try it on my pc it runs without any problem. But on another pc it gives this error: Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. I'm using SQL Server 2000 and for the application: Visual Studio 2005. Any idea would be very useful!! Thanks in advance!!

Powershell script that uses Microsoft.SqlServer.Management.Smo.Server need to use Sql Server Autheni

I have written a powershell script that uses Microsoft.SqlServer.Management.Smo.Server.  I have a couple of instances that are on different domains that I must use Sql Server authenication.  I am going to create a report user "sssmorpt".  What is the least a can grant this user to allow me to use Microsoft.SqlServer.Management.Smo.Server to get "$dbsize = $db.size - ($db.logfiles|measure-object -property size -sum).sum / 1024" for all databases in an instances?

Not able to install SqlServer 2008 says Restart computer failed

While trying to install SqlServer2008 it show Restart computer as failed. I have restarted my computer and still it shows the same error. Cant proceed further. Please advice on how to proceed to install SqlServer 2008.   Thanks Ashok

sql server 2008 - sqlserver(mssqlserver) services can't start

Sorry i need help, i have instal and reinstal sql 2008 over and over but always failed the problem is the services can't start and when i cek error log this written: http%3a%2f%2fgo.microsoft.com%2ffwlink%3fLinkId%3d20476%26ProdName%3dMicrosoft%2bSQL%2bServer%26EvtSrc%3dsetup.rll%26EvtID%3d50000%26ProdVer%3d10.0.1600.22%26EvtType%3d0xE53883A0%400xBE03358B%401306%4024

I have added new fields to a table in SQLserver, why could not find these new fields in Analysis Ser

I have added new fields to a table in SQLserver, why could not find these new fields in Analysis Services database source view?  My version is 2005.

Getting "wrong" data out of a microsoft.sqlserver.management.smo.database object property (using pow

My problem:I do something like this:$dbsvr = new-object microsoft.sqlserver.management.smo.server "servername"$dbsvr.databases | ft name,size -autosizeWhen i run this from two different PC's i get database sizes that are all the same (5.25 mb), the size of the first database listed - which is master.I started to try out a few things, and found out that when i run the same command from one of our servers it returns the correct sizes...Anyone have any idea if this a SMO issue, or maybe some package software version issue...- or what?

Windows Mobile 5 , SQLSERVER/EXPRESS VB.Net 2005 Datareader NullException

Hi all, Recently I have started learning developing Smart Device Applications using .Net.Am using WM 5.0 SQLServer 2005 Express and VS 2005 (VB). In my application, I made a form with some comboboxes and other fields.In the form load am calling a function in my classfile.This function intends to fill the combobox.Please refer the codes below. 1 . The Form Load event in the Form Imports ShoppingList.DB Public Class frmMain Dim objDB As New DB Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load objDB.FillComboBox(cmbCat, "SELECT * FROM TABLE ORDER BY ID_PK") End Sub End Class 2 .Now the DB cls file Imports System Imports System.Data Imports System.Data.SqlClient Public Class DB Dim strCon As String = "Data Source=,1010;Initial Catalog=DB_Shopping;User ID=***;Password=****" Public Sub FillComboBox(ByVal cmbTarget As ComboBox, ByVal Sql_SP As String) Dim dbConn As New SqlConnection(strCon) Dim sqlCMD As New SqlCommand(Sql_SP, dbConn) Try dbConn.Open() Dim dr As SqlClient.SqlDataReader dr = sqlCMD.ExecuteReader() 'dr = sqlCMD.ExecuteReader(CommandBehavior.SequentialAccess) While dr.Read() cmbTarget.Items.Add(dr(0)) End While
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend