'EOMONTH' is not a recognized built-in function name- SQL Server 2012 - sql

I installed the SQL Server 2012- Developer edition. When I apply SELECT ##version, I get:
Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86)
Dec 10 2010 10:56:29
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 6.1 (Build 7601: Service Pack 1)
But when I go to help, then about, It shows that it's SQL Server 2012.
I'm trying to use the EOMONTH function and I'm getting an error that the EOMONTH is unrecognizable built in function. Can anybody please help me understand what's going on? Thanks!I'm fairly new to T-SQL.

You might be connecting to an instance of SQL Server 2005 from SSMS 2012.
Make sure you select correct server/instance while connecting to Database Engine.

Related

Is PIVOT supported with compatibility_level 80?

I have written a query using PIVOT function.The db is on client side. When i am running the query it throws an error,
Incorrect syntax near 'PIVOT'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the SET COMPATIBILITY_LEVEL option of ALTER DATABASE.
After this I ran these two queries,
SELECT ##version;
SELECT compatibility_level FROM sys.databases WHERE name = 'db_name';
The output is
Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)
Jun 17 2011 00:54:03
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
and
80
I am not a db expert, But what I guess is they are using SQL server 2008 with compatibility mode of SQL server 2000 i.e 80 .Let me know if I am wrong. I do not think the Client will agree to change the compatibility level. So Is there any way to run a PIVOT query?

SQL server shows different versions when seen from about screen and from query

I had to see version of my sql server management studio, I went to Help --> About, it showed me following screen:
link to image: About Screen of my SQL Server Management Studio
It clearly shows that SQL Server is R2 with version 10.50.1600.1.
But when I run query
Select ##version, It returns me this:
Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86) Mar 29 2009 10:27:29 Copyright (c) 1988-2008 Microsoft Corporation Express Edition on Windows NT 5.1 (Build 2600: Service Pack 3)
Which shows it is not R2, also version is changes i.e 10.0.2531.0
I am not getting why is this? Can someone explain why both enquiries return different versions. Although I installed R2 in it.
And if it is not R2 then how to upgrade it to R2. Please help
You can see version of SQL Server on local computer by using Help\About. but when run select ##Version, you see version of SQL Server database engine that login on it. In other word you run SSMS from local computer and Help\About show version of SSMS. and then login to sql server database engine of your server, Select ##Version show version of sql server on the server.

Sql server configuration manager error

I am using Windows 7 32 bit OS and working on Microsoft SQL Server 2008, and when I open the configuration tool I got this error message.
Then I googled the error and got this below link.
http://www.microsoft.com/en-us/download/details.aspx?id=30437
Then I downloaded Microsoft® SQL Server 2008 R2 Service Pack 2
Then when I tried to install this application I got this error
How to solve this issue?? Any help appreciated.
In your question you write that you are using Microsoft SQL SERVER 2008but the download link is for Microsoft SQL Server 2008 R2, which is a different (newer) version. If you are indeed using the 2008 version and not 2008R2 what you want is the service pack for Microsoft SQL Server 2008: SQL Server 2008 Service Pack 3

There was an unknown error applying the filestream settings. check the parameters are valid

I am getting the following error while trying to configure FileStream in SQL server 2012.
There was an unknown error applying the filestream settings. check the parameters are valid. (0x80041008)
I am configuring it using SQL server configuration manager.
Where as I am able to setup it for SQL server 2008 R2.
I had this same problem just yesterday.
In my case it was because I had a 64-bit Windows and a 32-Bit SQL Server.
You do not see the exact error, but if you try to do it with T-SQL, then the proper error comes up in SQL, telling you something about "WOW64" not supporting filestream.
I just uninstalled and installed the right bit version of SQL, and all worked 100% again.
In my case the problem I was running the SQL Server 2014 configuration manager. While this usually shouldn't cause problems, in my case it did. Configuring FILESTREAM using the SQL Server 2012 configuration manager worked.
If it still doesn't work, make sure you're up-to-date. SQL Server 2012 has received quite a lot of patches (SP2, SP3, and some updates).
TL;DR
I simply installed Service pack 2 (SP2) patch of SQL Server 2008 R2 and everything started working for me.
Read on if you want to know more. Configuration wise my box was all correct and the file stream feature should have been working on my default instance of SQL Server 2008 R2. Here are my box details:
Operating System: Windows 7 Ultitmate SP1 (64 Bit)
SQL Server Version: SQL Server 2008 R2 SP1
On SQL Server if I run this query select ##version it was returning following details:
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
Whenever I opened SQL Server 2008 Configuration manager I will face this issue. Luckily I also had SQL Server 2014 installed on my machine. So I tried enabling File Stream feature from configuration manager GUI of SQL Server 2014 but it started giving error mentioned in current post.
I simply installed Service pack 2 (SP2) patch of SQL Server 2008 R2 and everything started working for me. SQL Server Configuration manager for 2008 R2 also works fine and I'm able to enable File Stream feature also without any trouble. SQL Server 2008 R2 SP2 can be downloaded from here.

Programmatically detect SQL Server Edition

I'm using C# with SMO and attempting to detect what edition of SQL Server (e.g., enterprise, standard) I'm connecting to. I know how to get the version information, but that only tells me what version of SQL Server (e.g., SQL Server 2008 vs SQL Server 2005).
Does anyone know how to get the actual product edition (e.g., enterprise, standard)?
I need this information because some SQL Server features are only enterprise. Thus, I could just try to call them and catch the exception, but I'd much prefer an upfront detection.
Thanks!
SELECT SERVERPROPERTY('productversion'),
SERVERPROPERTY ('productlevel'),
SERVERPROPERTY ('edition')
on my system returns
9.00.1399.06, RTM, Express Edition
It seems this technique only works on SQL Server 2000 or later, if any of your databases are 7.0 or less, you'll have to use ##Version and manipulate the results as others have posted
It looks like you might be able to do it via SMO and the Server object. There are properties like Information.Edition which looks like it should do what you want.
I've always used ##Version (eg. SELECT ##Version and manipluted the result in code), but this article looks pretty handy;
http://support.microsoft.com/kb/321185
The only issue with using SERVERPROPERTY, as per the link... is that this won't work with older version of SQL Server.
select ##version
Returns version and which edition. Here:
Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)
Nov 24 2008 13:01:59
Copyright (c) 1988-2005 Microsoft Corporation
Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
Check the registry. This question had a good method you could adapt from the PowerShell script:
How do I check for the SQL Server Version using Powershell?