Error while restoring sql database in microsoft sql server 2012

I found below error while restoring a database to Microsoft SQL Server 2012.System.Data.SqlClient.SqlError: The operating system returned the error 5(Access is denied.) I solved this problem by doing below step:In restore window, from left side pane click on FilesThen in properties please ensure that “Relocate all files to folder” is checked. Try this, i resolved … Read more

How to automatically generate unique id in sql?

In sql there are many options to generate unique number. Here I am explaining about how to generate standard unique number in sql. Below is sql query : CREATE TABLE dbo.tblTable1  (ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,   UserID AS UID + RIGHT(00000000 + CAST(ID AS VARCHAR(8)), 8) PERSISTED,   username varchar(200),city varchar(200)  )

Bulk copy data from excel sheet to sql table

How to process bulk copy data from excel sheet to sql table. Here is code to copy data from excel to sql.       C# Code:       string excelFile = @”C:Book1.xls”;        string ssqlTable = “[MyTableName]”;        string exceldataQuery = “select [id],[email],[status] from [Sheet1$]”;        try    … Read more

RSS
YouTube
YouTube
Instagram