How to unpivot in SQL Server 2008 R2
Hi,
I have data like below:
AvgPetrolPrice
AvgKerosenePrice
AvgGasOilPrice
GrowthRatePetrol
GrowthRateKerosene
GrowthRateGasOil
685
689
688
0.21
0.21
0.21
I need output like below:
Product
Avg for the Year
Growth Rate for the Year
Petrol
685
0.21
Kerosene
689
0.21
Gas Oil
688
0.21
Please help ASAP.
Regards,
Srini
See example
DECLARE @Table TABLE
UserId INT,
Day1 INT NULL,
Day2 INT NULL,
Day3 INT NULL,
Day4 INt NULL,
DayMax Int NULL
INSERT INTO @Table(UserId, Day1, Day2, Day3, Day4, DayMax)
VALUES(1,10,null,20,3,null);
INSERT INTO @Table(UserId, Day1, Day2, Day3, Day4, DayMax)
VALUES(2,50,25,15,5,null);
SELECT UserId, DayQuantity AS DayMax FROM @Table
UNPIVOT (DayQuantity FOR DayNumber IN (Day1,Day2,Day3,Day4)) AS c
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence
Similar Messages
-
How to attached a sql server 2008 database on sql server 2005
Hi,
I have a backup of database designed over sql server 2008. I need to attacched this on a machine where sql server 2005 is installed and I am getting the message while attaching the database.
"The database can not be opened because it is version 661.
the server supports version 611 and earlier"You need to install/have another instance of SQL Server 2008, restore over there the database and perhaps create a SSIS package to move objects and data into SQL Server 2005
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to connect to SQL SERVER 2008 from labview
We have installed a SQL server 2008 in the local PC and through DSN we were able to connect to the database on the same PC . Now we have loaded SQL server 2008 in another PC but in same network but we are not able connect to the database. we can do it with connnectiong string?
Thanks for your reply,
We verified through DSN it works, we are able to connect to database by DSN.
But the issue is for connecting it to database we need to dynamically obtain the IP by choosing the Obtain the IP address automatically in TCP/IP Properties.
Whereas all the other devices connected to the PC are having static IP of 192.168.127.xxx from which we are getting the data. Also the PC IP address is 192.168.127.001 which is connected to the devices with a LAN switch to acquire the data from these devices.
Now i can either communicate with the devices using static IP address 192.168.127.1 or connect to database using dynamic address.
A separate LAN port will solve or is there solution for this issue? -
How can I convert SQL Server 2008 Timestamp to DB2/iSeries Timestamp?
In DB2/iSeries I have a column that accepts Timestamp value. When I try to insert a timestamp value from the SQL 2008 table and into DB2/iSeries table I recieve the following error message:
OLE DB provider "IBMDA400" for linked server "XXX" returned message "SQL0180: Syntax of date, time, or timestamp value not valid.
Cause . . . . . : The string representation of a date, time, or timestamp value does not conform to the syntax for the specified or implied data type and format. *N is either the character string constant that is not valid or the column or host
variable that contained the string. If the name is *N, then the value is an expression specified in the statement. If the string was found in a host variable, the host variable number is 1. Recovery . . . : Ensure that the date, time, or
timestamp value conforms to the syntax for the data type it represents. Try the request again.".
Msg 7343, Level 16, State 2, Line 1
The OLE DB provider "IBMDA400" for linked server "XXX" could not INSERT INTO table "[IBMDA400]".
The SQL timestamp column contains the result in the following format:
2014-04-24 07:39:09.000
And my insert TSQL command is:
INSERT INTO OPENQUERY(XXX, 'Select "TimeOfDeal" from ABCD.TICKETS')
SELECT TimeOfDeal
FROM dbo.Tickets
WHERE DealId = 'ABC123'
I appreciate any help on this issue.You are right it is a datetime data type in MS SQL, and a Timestamp in DB2.
I cast it to datetime2 and it worked.
Interesting. I would guess that somewhere under the covers, the date value gets converted to a string, and the different default string formats for datetime and datetime2 is illustrated with this statement:
SELECT convert(varchar, getdate()), convert(varchar, sysdatetime())
When I ran it, I got these values:
Feb 23 2015 12:31PM 2015-02-23 12:31:18.3708899
Now, why there is a conversion to string in the first place, I'm afraid I don't have any good answer to.
Erland Sommarskog, SQL Server MVP, [email protected] -
Oracle 9i to Sql server 2008 R2 migration
Hi,
We are having oracle 9i as database and migrating to sql server 2008.
Our oracle 9i database connects to another oracle databases and these databases are having different oracle version(9.2.0.8.0, 9.2.0.7.0,10.2.0.5.0,11.2.0.2.0,9.2.0.6.0,10.2.0.4.0,8.1.7.4.0 )
I do have two queries :
1) how to connect from Sql server 2008 R2 to different Oracle databases
2) How will other oracle databases connect to Sql server 2008 R2 databaseHi,
1) how to connect from Sql server 2008 R2 to different Oracle databasesYou can create "Linked Servers".
<<http://www.c-sharpcorner.com/uploadfile/suthish_nair/linked-servers-in-sql-server-2008/>>
2) How will other oracle databases connect to Sql server 2008 R2 databaseYou can create "Database link"
<<http://www.databasejournal.com/features/oracle/article.php/10893_3442661_2/Making-a-Connection-from-Oracle-to-SQL-Server.htm>>
But I do not know that old db (like 8i) can connect to 2008R2..
Regards, -
How to export data with column headers in sql server 2008 with bcp command?
Hi all,
I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
am trying to import data with bcp command data has been copied but column names are not came.
I am using the below query:-
EXEC master..xp_cmdshell
'BCP "SELECT * FROM [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
Thanks,
SAAD.Hi All,
I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
DECLARE @BCPCMD
nvarchar(4000)
DECLARE @BCPCMD1
nvarchar(4000)
DECLARE @BCPCMD2
nvarchar(4000)
DECLARE @SQLEXPRESS
varchar(50)
DECLARE @filepath
nvarchar(150),@SQLServer
varchar(50)
SET @filepath
= N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
as varchar(4))
+RIGHT('00'+CAST(MONTH(GETDATE())
as varchar(2)),2)
+RIGHT('00'+CAST(DAY(GETDATE())
as varchar(2)),2)+'.log" '
Set @SQLServer
=(SELECT
@@SERVERNAME)
SELECT @BCPCMD1
= '''BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT '
SELECT @BCPCMD2
= '-c -t , -T -S '
+ @SQLServer +
SET @BCPCMD
= @BCPCMD1+ @filepath
+ @BCPCMD2
Print @BCPCMD
-- Print out below
'BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
EXEC
master..xp_cmdshell
@BCPCMD
''BCP' is not recognized as an internal or external command,
operable program or batch file.
NULL
if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
EXEC
master..xp_cmdshell
'BCP "SELECT * FROM
[tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
Thanks, SAAD. -
Hi,
I have to implement the following scenario in SSIS but don't know how to do since I never worked with SSIS before. Please help me.
I have 20 different text files in a single folder and 20 different tables corresponding to each text file in SQL Server 2008 R2 Database. I need to extract the data from each text file and
load the data into corresponding table in Sql Server Database. Please guide me in how many ways I can do this and which is the best way to implement this job. Actually I have to automate this job. Few files are in same format(with same column names
and datatypes) where others are not.
1. Do I need to create 20 different projects ?
or
Can I implement this in only one project by having 20 packages?
or
Can I do this in one project with only one package?
Thanks in advance.As I said I don't know how to use object data type, I just given a shot as below. I know the following code has errors can you please correct it for me.
Public
Sub Main()
' Add your code here
Dim f1
As FileStream
Dim s1
As StreamReader
Dim date1
As
Object
Dim rline
As
String
Dim Filelist(1)
As
String
Dim FileName
As
String
Dim i
As
Integer
i = 1
date1 =
Filelist(0) =
"XYZ"
Filelist(1) =
"123"
For
Each FileName
In Filelist
f1 = File.OpenRead(FileName)
s1 = File.OpenText(FileName)
rline = s1.ReadLine
While
Not rline
Is
Nothing
If Left(rline, 4) =
"DATE"
Then
date1 (i)= Mid(rline, 7, 8)
i = i + 1
Exit
While
End
If
rline = s1.ReadLine
End
While
Next
Dts.Variables(
"date").Value = date1(1)
Dts.Variables(
"date1").Value = date1(2)
Dts.TaskResult = ScriptResults.Success
End
Sub -
I have used SSRS a lot years ago with Sql Server 2000 and Sql Server 2005. I have written external assemblies, ... But now I have to do this with Sql Server 2008 (R2 -- which I realize I am way behind the times already but ...) in sql server 2000 and
2005 there was a tab for datasource to the left of the tab for design which was to the left of the preview tab. How do I get to the datasource window in sql server 2008 (r2) ?
I see that datasource explorer. But where can I get to the datasource window to edit my queries and so forth for sql server 2008 (R2)?
Thanks
Rich PI think I found the answer to my question --- just right-click on the the Data Sources or Datasets for editing connections and dataset queries. I'm guessing it gets even fancier with Sql Svr 2012 - 2014. Man, that's the one thing
about coding platforms -- you let it go for a few years and come back, and everything has changed (well, a lot of things). Now I need to figure out how to add an external assembly to SSRS 2008 (R2).
Rich P -
How to install SQL SERVER 2008 r2 in window 7 home premimum 64bit
how to install SQL SERVER 2008 r2 in home premimum 64bit os. can any say that weather it will support or not in window 7 home premimum os.
my server log file:
Final result: SQL Server installation failed.
To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
Exit code (Decimal): -2068052700
Exit facility code: 1212
Exit error code: 1316
Exit message: SQL Server installation
failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
Start time: 2014-03-27 00:52:25
End time: 2014-03-27
00:56:09
Requested action: Install
Log with failure: C:\Program Files\Microsoft SQL
Server\100\Setup Bootstrap\Log\20140327_005035\SSCRuntime_Cpu32_1.log
Exception help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.50.1600.1
Machine Properties:
Machine name: SEVALAL-PC
Machine processor count: 4
OS version: Windows 7
OS service pack: Service Pack 1
OS region: United States
OS language: English (United States)
OS architecture: x64
Process architecture: 64 Bit
OS clustered: No
Product features discovered:
Product Instance
Instance ID Feature Language
Edition Version Clustered
Sql Server 2008 R2 MSSQLSERVER MSSQL10_50.MSSQLSERVER
Database Engine Services 1033 Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSSQL10_50.MSSQLSERVER
SQL Server Replication 1033 Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSSQL10_50.MSSQLSERVER
Full-Text Search 1033 Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSAS10_50.MSSQLSERVER
Analysis Services 1033 Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSRS10_50.MSSQLSERVER
Reporting Services 1033 Standard Edition 10.50.1600.1 No
Sql Server 2008 SEVALAL MSSQL10.SEVALAL
Database Engine Services 1033 Express Edition 10.3.5500.0
No
Sql Server 2008 SEVALAL MSSQL10.SEVALAL
SQL Server Replication 1033 Express Edition 10.3.5500.0
No
Sql Server 2008 R2
Client Tools Connectivity 1033
10.50.1600.1 No
Sql Server 2008 R2
Client Tools Backwards Compatibility 1033
10.50.1600.1 No
Sql Server 2008 R2
Client Tools SDK 1033
10.50.1600.1 No
Package properties:
Description: SQL Server Database Services
2008 R2
ProductName: SQL Server 2008 R2
Type: RTM
Version: 10
SPLevel: 0
Installation location: G:\01.SQL Server 2008 R2 FullVersion\x64\setup\
Installation edition: STANDARD
User Input Settings:
ACTION: Install
ADDCURRENTUSERASSQLADMIN: False
AGTSVCACCOUNT: <empty>
AGTSVCPASSWORD: *****
AGTSVCSTARTUPTYPE: Manual
ASBACKUPDIR: Backup
ASCOLLATION: Latin1_General_CI_AS
ASCONFIGDIR: Config
ASDATADIR: Data
ASDOMAINGROUP: <empty>
ASLOGDIR: Log
ASPROVIDERMSOLAP: 1
ASSVCACCOUNT: <empty>
ASSVCPASSWORD: *****
ASSVCSTARTUPTYPE: Automatic
ASSYSADMINACCOUNTS: <empty>
ASTEMPDIR: Temp
BROWSERSVCSTARTUPTYPE: Disabled
CONFIGURATIONFILE: C:\Program Files\Microsoft SQL Server\100\Setup
Bootstrap\Log\20140327_005035\ConfigurationFile.ini
CUSOURCE:
ENABLERANU: False
ENU: True
ERRORREPORTING: True
FARMACCOUNT: <empty>
FARMADMINPORT: 0
FARMPASSWORD: *****
FEATURES: IS,SSMS,ADV_SSMS,OCS
FILESTREAMLEVEL: 0
FILESTREAMSHARENAME: <empty>
FTSVCACCOUNT: <empty>
FTSVCPASSWORD: *****
HELP: False
IACCEPTSQLSERVERLICENSETERMS: False
INDICATEPROGRESS: False
INSTALLSHAREDDIR: C:\Program Files\Microsoft SQL
Server\
INSTALLSHAREDWOWDIR: C:\Program Files (x86)\Microsoft SQL Server\
INSTALLSQLDATADIR: <empty>
INSTANCEDIR: C:\Program Files\Microsoft
SQL Server
INSTANCEID: MSSQLSERVER
INSTANCENAME: MSSQLSERVER
ISSVCACCOUNT: NT AUTHORITY\SYSTEM
ISSVCPASSWORD: *****
ISSVCSTARTUPTYPE: Automatic
NPENABLED: 0
PASSPHRASE: *****
PCUSOURCE:
PID: *****
QUIET: False
QUIETSIMPLE: False
ROLE: <empty>
RSINSTALLMODE: FilesOnlyMode
RSSVCACCOUNT: <empty>
RSSVCPASSWORD: *****
RSSVCSTARTUPTYPE: Automatic
SAPWD: *****
SECURITYMODE: <empty>
SQLBACKUPDIR: <empty>
SQLCOLLATION: SQL_Latin1_General_CP1_CI_AS
SQLSVCACCOUNT: <empty>
SQLSVCPASSWORD: *****
SQLSVCSTARTUPTYPE: Automatic
SQLSYSADMINACCOUNTS: <empty>
SQLTEMPDBDIR: <empty>
SQLTEMPDBLOGDIR: <empty>
SQLUSERDBDIR: <empty>
SQLUSERDBLOGDIR: <empty>
SQMREPORTING: True
TCPENABLED: 0
UIMODE: Normal
X86: False
Configuration file: C:\Program Files\Microsoft SQL Server\100\Setup
Bootstrap\Log\20140327_005035\ConfigurationFile.ini
Detailed results:
Feature: Integration
Services
Status: Failed:
see logs for details
MSI status: Passed
Configuration status: Passed
Feature: Management
Tools - Complete
Status: Failed:
see logs for details
MSI status: Passed
Configuration status: Passed
Feature: Management
Tools - Basic
Status: Failed:
see logs for details
MSI status: Passed
Configuration status: Passed
Feature: Microsoft Sync
Framework
Status: Failed:
see logs for details
MSI status: Passed
Configuration status: Passedmy summary log file information:
Overall summary:
Final result: SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
Exit code (Decimal): -2068052700
Exit facility code: 1212
Exit error code: 1316
Exit message: SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
Start time: 2014-03-27 00:52:25
End time: 2014-03-27 00:56:09
Requested action: Install
Log with failure: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140327_005035\SSCRuntime_Cpu32_1.log
Exception help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.50.1600.1
Machine Properties:
Machine name: SEVALAL-PC
Machine processor count: 4
OS version: Windows 7
OS service pack: Service Pack 1
OS region: United States
OS language: English (United States)
OS architecture: x64
Process architecture: 64 Bit
OS clustered: No
Product features discovered:
Product Instance Instance ID Feature
Language Edition Version Clustered
Sql Server 2008 R2 MSSQLSERVER MSSQL10_50.MSSQLSERVER Database Engine Services 1033
Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSSQL10_50.MSSQLSERVER SQL Server Replication 1033
Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSSQL10_50.MSSQLSERVER Full-Text Search 1033
Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSAS10_50.MSSQLSERVER Analysis Services 1033
Standard Edition 10.50.1600.1 No
Sql Server 2008 R2 MSSQLSERVER MSRS10_50.MSSQLSERVER Reporting Services 1033
Standard Edition 10.50.1600.1 No
Sql Server 2008 SEVALAL MSSQL10.SEVALAL Database Engine Services 1033
Express Edition 10.3.5500.0 No
Sql Server 2008 SEVALAL MSSQL10.SEVALAL SQL Server Replication 1033
Express Edition 10.3.5500.0 No
Sql Server 2008 R2 Client Tools Connectivity
1033 10.50.1600.1 No
Sql Server 2008 R2 Client Tools Backwards Compatibility
1033 10.50.1600.1 No
Sql Server 2008 R2 Client Tools SDK
1033 10.50.1600.1 No
Package properties:
Description: SQL Server Database Services 2008 R2
ProductName: SQL Server 2008 R2
Type: RTM
Version: 10
SPLevel: 0
Installation location: G:\01.SQL Server 2008 R2 FullVersion\x64\setup\
Installation edition: STANDARD
User Input Settings:
ACTION: Install
ADDCURRENTUSERASSQLADMIN: False
AGTSVCACCOUNT: <empty>
AGTSVCPASSWORD: *****
AGTSVCSTARTUPTYPE: Manual
ASBACKUPDIR: Backup
ASCOLLATION: Latin1_General_CI_AS
ASCONFIGDIR: Config
ASDATADIR: Data
ASDOMAINGROUP: <empty>
ASLOGDIR: Log
ASPROVIDERMSOLAP: 1
ASSVCACCOUNT: <empty>
ASSVCPASSWORD: *****
ASSVCSTARTUPTYPE: Automatic
ASSYSADMINACCOUNTS: <empty>
ASTEMPDIR: Temp
BROWSERSVCSTARTUPTYPE: Disabled
CONFIGURATIONFILE: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140327_005035\ConfigurationFile.ini
CUSOURCE:
ENABLERANU: False
ENU: True
ERRORREPORTING: True
FARMACCOUNT: <empty>
FARMADMINPORT: 0
FARMPASSWORD: *****
FEATURES: IS,SSMS,ADV_SSMS,OCS
FILESTREAMLEVEL: 0
FILESTREAMSHARENAME: <empty>
FTSVCACCOUNT: <empty>
FTSVCPASSWORD: *****
HELP: False
IACCEPTSQLSERVERLICENSETERMS: False
INDICATEPROGRESS: False
INSTALLSHAREDDIR: C:\Program Files\Microsoft SQL Server\
INSTALLSHAREDWOWDIR: C:\Program Files (x86)\Microsoft SQL Server\
INSTALLSQLDATADIR: <empty>
INSTANCEDIR: C:\Program Files\Microsoft SQL Server
INSTANCEID: MSSQLSERVER
INSTANCENAME: MSSQLSERVER
ISSVCACCOUNT: NT AUTHORITY\SYSTEM
ISSVCPASSWORD: *****
ISSVCSTARTUPTYPE: Automatic
NPENABLED: 0
PASSPHRASE: *****
PCUSOURCE:
PID: *****
QUIET: False
QUIETSIMPLE: False
ROLE: <empty>
RSINSTALLMODE: FilesOnlyMode
RSSVCACCOUNT: <empty>
RSSVCPASSWORD: *****
RSSVCSTARTUPTYPE: Automatic
SAPWD: *****
SECURITYMODE: <empty>
SQLBACKUPDIR: <empty>
SQLCOLLATION: SQL_Latin1_General_CP1_CI_AS
SQLSVCACCOUNT: <empty>
SQLSVCPASSWORD: *****
SQLSVCSTARTUPTYPE: Automatic
SQLSYSADMINACCOUNTS: <empty>
SQLTEMPDBDIR: <empty>
SQLTEMPDBLOGDIR: <empty>
SQLUSERDBDIR: <empty>
SQLUSERDBLOGDIR: <empty>
SQMREPORTING: True
TCPENABLED: 0
UIMODE: Normal
X86: False
Configuration file: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140327_005035\ConfigurationFile.ini
Detailed results:
Feature: Integration Services
Status: Failed: see logs for details
MSI status: Passed
Configuration status: Passed
Feature: Management Tools - Complete
Status: Failed: see logs for details
MSI status: Passed
Configuration status: Passed
Feature: Management Tools - Basic
Status: Failed: see logs for details
MSI status: Passed
Configuration status: Passed
Feature: Microsoft Sync Framework
Status: Failed: see logs for details
MSI status: Passed
Configuration status: Passed
Rules with failures:
Global rules:
Scenario specific rules:
Rules report file: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20140327_005035\SystemConfigurationCheck_Report.htm -
How to restore SQL Server 2008 database to SQL Server Express 2012
How to restore SQL Server 2008 database to SQL Server Express 2012.
I BACKED UP a SQL Server 2008 database from work, which runs the enterprise version of 2008, and I tried to RESTORE it to my new 64-Bit home PC which is running the new SQL Server Express 2012 64-Bit (Advanced Edition).
But if fails. I get the following message text.
Can anyone help me please. I thought restoring a 2008 database to the later version 2012 would be possible.
Here is the error message. Thanks.
TITLE: Microsoft SQL Server Management Studio
Restore of database failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The database was backed up on a server running version 8.00.2039. That version is incompatible with this server, which is running version 11.00.3128. Either restore the database on a server that supports the backup, or use a
backup that is compatible with this server. (Microsoft.SqlServer.SmoExtended)ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The database was backed up on a server running version 8.00.2039. That version is incompatible with this server, which is running version 11.00.3128. Either restore the database on a server that supports the
backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.SmoExtended)
Are you sure your database is SQL server 2008 from error message it seems your SQL server version is 2000.I guess you have multiple versions of SQL server.
AFAIK you cannot restore backup of SQL server 2000 to 2012 directly .Restore it first to SQL 2008/2008R2 or 2005 then take backup again of new database created and then you would be able to restore it on 2012.Its kind of intermediate way
Also make sure your DB size is less than 10 G as max DB size supported by Express edition is 10 G and if your DB size is more than 10 G restore will fail.
You are also trying to restore enterprise DB backup on express edition so you will loose enterprise features on express edition
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers -
How to stop SQL Server 2008 R2 generating SQLDump.mdmp files constantly?
Something went wrong with local SQL Server 2008 R2 and it constantly generates SQLDump.mdmp files. It generated 40Gb(!) of SQLDump.mdmp this morning. Server rebooted, but didn't help.
Any ideas what happened with SQL Server and how to stop SQLDump.mdmp files generation?
SharePoint 2007 - 2010 Tips & Tricks Portal | Microsoft MVP |
My Blog about Information Management |
My twitterMemory Dumps are generated automatically by the SQL Server under various circumstances - most of which indicate potential problems in the Instance or the machine. Some that I can recall right now are:
Database Corruption
Non-yielding scheduler
Non-yielding resource monitor
AV (Access Violation)
There can be several other reasons as well. SQL Server generates the dumps, so that these dumps can be analyzed to find out potential problems in the SQL Server.
IMHO, rather than trying to find out ways to stop the dumps from being generated, please try to find out potential problems in the Instance or the machine and fix that. This will stop the dump generation anyway.
In case you need any assistance in analyzing the Dumps, please feel free to engage Microsoft Support.
Suhas De
Please mark solved if your question is completely answered; vote it as helpful to help others find a solution quicker.
This posting is provided "AS IS" with no warranties, and confers no rights.
My Blog: http://blogs.msdn.com/b/suhde -
How to connect sql server 2008 r2 sp2 with vs2013 ultimate?
how to connect sql server 2008 r2 sp2 with visual studio 2013 ultimate?
Hi Shahzad,
>>how to connect sql server 2008 r2 sp2 with visual studio 2013 ultimate?
Based on your issue, if you wan to connect the sql server 2008 r2 sp2 from VS2013 IDE. I suggest you can try the Ammar and darnold924's suggestion to check your issue.
In addition, I suggest you can also refer the following steps to connect the sql server 2008 r2 sp2 with visual studio 2013 ultimate.
Step1: I suggest you can go to VIEW->SQL Server Object Explorer->Right click SQL Server->Add SQL Server.
Step2: After you connect the SQL Server 2008 r2 sp2 fine, I suggest you can go to VIEW->Server Explorer-> right click the Data Connection->Add Connection.
And then you can create the connect string in the Add Connection dialog box.
Hope it help you!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to change backend databases sql server 2008 R2 to Sql server 2012 datacenter
Hi
i have current sharepoint 2010 form has backend database is sql server 2008 R2 on windows server 2008 R2 Enterprise
and this form has
1 application server
1 Search server (index server)
1 wfe server ( all web applications are running)
1 databse server
here how i change this form back end to new windows server 2012 and sql server 2012 datacenter
adilInformation on SQL Aliases (using cliconfg.exe):
http://sqlandme.com/2011/05/05/create-sql-server-alias-cliconfg-exe/
You need to migrate content back into the database prior to migration:
http://technet.microsoft.com/en-us/library/ff628255(v=office.14).aspx
http://technet.microsoft.com/en-us/library/ff628257(v=office.14).aspx
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
How to attach .mdf file to sql server 2008 EXPRESS
I have .mdf files created using SQL SERVER management studio 2012 in another computer and wish to attach the same to SQL SERVER 2008 EXPRESS in another computer. How should I do so? I tried this method :How
to: Attach a Database File to SQL Server Express but then it shows an error that the database cannot be created due to compatibility issues.
Msg 948: The database xyz cannot be opened because it is version 706. This server supports version 655 and earlier. A downward path is not supported..
Any help??I have .mdf files created using SQL SERVER management studio 2012 in another computer and wish to attach the same to SQL SERVER 2008 EXPRESS in another computer. How should I do so? I tried this method :How
to: Attach a Database File to SQL Server Express but then it shows an error that the database cannot be created due to compatibility issues.
Msg 948: The database xyz cannot be opened because it is version 706. This server supports version 655 and earlier. A downward path is not supported..
Any help??
You are trying to attach SQL Server 2012 database files to SQL Server 2008 R2 which is not allowed, you either need to upgrade your SQL Server 2008 to 2012 or alternatively you can generate all scripts from SQL Server 2012 and execute it in SQL Server
2008 R2.
You can refer below link to how to generate script.
http://blog.sqlauthority.com/2012/07/18/sql-server-generate-script-for-schema-and-data-sql-in-sixty-seconds-021-video/
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 |
My Blog | My Page -
How to configure Sql Server 2008 R2 for debugging without disabling Windows Firewall?
When I try to debug a procedure in Sql Server 2008 R2 I get a dialog box telling me to unblock some ports.
>>
The Windows Firewall on this machine is currently blocking remote debugging. Remote debugging requiers that the debugger be allowed to receive informatino from the network. Remote debugging also requires DCOM (TCP Port 135) and IPSEC (UDP 4500
/ UDP 500) be unblocked.
<<
I went to the Windows Firewall and added some new Inbound rules for each of the specified ports (in the images below. But after this and rebooting entire computer -- I still get this dialog box when I want to go into debug mode from SSMS. I can
actually kind of debug standalone code in the SSMS window if I cancel the dialog box. But I can't debug an actual stored procedure -- which is what I need to do. I also noticed that my server has an IP address instead of LocalHost. This is
not a public Server -- it's my private development machine which is on a peer to peer network (with one other workstation), but I don't need that workstation to be able to access this server.. Would localholst make a difference for debugging? How
should I configure the sql server? The firewall?
Rich PUse PRINT and SELECT for debugging. That's what I do. I used to play with the debugger in SQL 2000 and older days, but I realised that I spent more time on getting it to work that I gained from using it.
I thought about that. I guess that IS the way to go. Very well. Thank you for the suggestion. Although, when the debugger does work in the regular window (not a stored proc because it doesn't work there) the debugger IS nice.
For debugging my proc I am thinking I will insert param vals into a test collection table for now. One obscure error I am getting with a particular proc -- in a When loop on one parameter I get the "value will be truncated" error -- but everything
is set to accept 1000 characters and none of the source data even comes close to 1000 characters. I have isolated at what point the error occurs and which section of data where the error is occurring but I have not isolated the cause of the error.
I cannot reproduce the error when I run the procedure by hand in a regular query window with the exact same code. The error only occurs when the code is run in the stored proc.
Rich P
Maybe you are looking for
-
How do I get a "PLAY ALL" button on the main screen for iDVD?
I spent a lot of time creating a DVD with pictures and music, and the main screen when I play the DVD shows all of the different scenes, but when I click on one of the scenes, it won't continue to the next one. I have to individually plan every scene
-
Can I set a password for clearing the history?
I want to have a password set when deleting the history so I can track what is being used on my computer. Either that or hide were the history button is located
-
hi friends, Here is my query on a Alv Report output display I have two internal tables i_vbak and i_vbap i_vbak contains the fields and value as vbeln kunnr auart audat bstnk vkorg 1000066 1000071 ze0r 200
-
I have a MacBook (purchased June 2006 with Mac OS X v10.4 Tiger). Since MobileMe was launched, I have been unable to change my "out of office" setting via the Apple Website - I used to be able to do this through 'preferences' but the 'save' button ha
-
Job completed but status showing still yellow
Hi Experts, One of full load status tab showing yellow, but the job completed when i checked in SM37. I am loading from ODS to Cube there is no PSA. we are using 3.5 version.