I want to update some JSON data in SQLite database (.db file) and I met a problem.
I work in Microsoft SQL Server Management Studio where I added SQLite/SQL Server Compact Toolbox through Visual Studio Extensions. I'm succesfully able to connect to this file and I'm also able to run a query on this database (create table, insert data etc.). The only problem is that a table I want to update has a JSON column and I need to use the JSON_VALUE function to get some data from that column. And when I run SELECT JSON_VALUE([data]) FROM myTable, I get an error message:
ErrorCode : 1
Message : SQL logic error
no such function: json_value
Result : Error
for a query SELECT sqlite_version I got a result 3.24.0.
What am I doing wrong? What should I add to system to make this thing working? In standard SQL everything is working fine. SSMS is version 14.0.
I also tried programs "DB Browser for SQLite" and "SQLiteStudio" and also did the same example in Visual Studio and got exactly the same error.
Any hints (please step by step, I'm totally new to SQLite) would be appreciated.
We recently updated SQL Server from:
Microsoft SQL Server 2017 (RTM-CU9-GDR) (KB4293805) - 14.0.3035.2 (X64)
to:
Microsoft SQL Server 2017 (RTM-CU14-GDR) (KB4494352) - 14.0.3103.1 (X64)
In one of the extraction jobs we are using SQL like:
SELECT
XMLNode_Root.R.value('./#ID', 'INTEGER') AS [SellerID],
CAST(XMLNode_Root.R.value('../#ID', 'VARCHAR(25)') AS BIGINT) AS [ApplicationID]
FROM Stage.LoanAppl_XML AS AD
CROSS APPLY AD.ApplicationXMLPackage.nodes('//MessageResponse/body/Application/Seller') AS XMLNode_Root(R)
OPTION(USE HINT('ENABLE_PARALLEL_PLAN_PREFERENCE'));
Recently, on random occasions this select started to return NULL values for ApplicationID column even the ID is defined in the parent.
What is interesting:
1. If I do any change to SQL Select, like change case or add spaces it returns correct values.
2. Running dbcc freeproccache solves the problem for some time.
I have execution plan saved before and after clearing cache, but can't post it now.
I wonder if anybody had similar issue and was able to find a solution.
From the Object Explorer of SQL Server Management Studio I renamed a table from nameA to nameB. When I query SELECT * from nameB I receive the error
object name 'nameA' not valid
This happens both from Management Studio and an external application. SELECT * from nameA gives the same error.
Restarting the service didn't help. Table name in sysobjects is correct. Is there maybe another place where SQL Server looks up table names? Thanks, it's getting me quite crazy :S
I'm using SQL Server 11.0.2100.60
Solved with a workaround:
I generated scripts for table schema and data, dropped the table and run scripts to recreate table schema and data. NOTE: I needed to manually modify the generated scripts because of mistakes in smalldatetime fields which made the generated INSERTs fail.
So it seems that dropping tables resets the "denormalized" SQL Server internal catalog which was left inconsistent somewhen. Thanks MS! ;)
I am using SQL Server 2008 R2. It is working fine. But recently, I have changed my hosting server and I came to know that they have installed SQL Server 2012 on Server.
Now, Issue is that after connecting with Server Database through SQL Server 2008 R2, When I click on any table name or Stored Procedure, I am getting error : Index was outside the bounds of the array. (Microsoft.SqlServer.smo)
So, is there any issue from my side or It is from Server Side ??? and How can I prevent this issue ?
Restarting the Management Studio worked for me.
Upgrade your SqlServer management studio from 2008 to 2012
Or
Download the service packs of SqlServer Management Studio and update probably resolve you solution
You can download the SQL Server Management studio 2012 from below link
Microsoft® SQL Server® 2012 Express http://www.microsoft.com/en-us/download/details.aspx?id=29062
For me this problem still exists with SSMS version 2016 (13.0.16100.1).
A decent workaround is to not use the 'Right click' -> 'Add table...' dialog, but simply drag the table you want to add from the Object Explorer, onto the Diagram surface. While dragging the mouse icon changes into an 'add' symbol and the table is added when you release the mouse.
Beats having to close SSMS every time.
Restarted worked!
I found the same error to add new table to my database diagram on sql server 2016, restarted sql server management studio, finally solved.
This is an issue if you are using 2008 management studio tools to connect to a SQL 2012 instance.
I experience this a lot if I am working on one server with SQL 2008, and trying to quickly query another server that is running SQL 2012.
I normally keep my personal workstation on the latest version of management studio (2012 in this case), and am able to administer all servers from there.
The Reason behind the error message is that SQL couldn't show new features in your old SQL server version.
Please upgrade your client SQL version to same as your server Sql version
Solution: Ignore the error
Just to show that the error does not do much in SSMS version 18.9.2, drag the table to be shown in the diagram from the Object Explorer tab and wait for it to finish loading before you start using it.
The suggested causes are now proven to be mostly impossible. I'm running SSMS V17.9.2 against SS 2014 and still have the problem. Memory problems have existed with this tool since at least 2006 when I started using SSMS.
Yes, MS 'wants' to get rid of diagramming but users won't let them. I have a feeling they will never fix any of these issues because they want users to be so fed up with the tool that enough of them quit using it and they can abandon it entirely.
Restarting is still a workaround if you can stand doing so numerous times per day.
you must use new version of Management Studio. And also you will got an error 29506. so you should run as Administrator for setup.
Look this site.
http://shareis.com/post/29506-management-studio-express
I had a similar experience with using SMO via C# with the stack trace:
[1896] System.IndexOutOfRangeException: Index was outside the bounds of the array.
[1896] at Microsoft.SqlServer.Management.Smo.BitStorage.SetBit(Int32 itemIndex, BitIndex bitIndex, Boolean value)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AddObjectPropsFromDataReader(IDataReader reader, Boolean skipIfDirty, Int32 startColIdx, Int32 endColIdx)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ImplInitialize(String[] fields, OrderBy[] orderby)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.Initialize(Boolean allProperties)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.OnPropertyMissing(String propname, Boolean useDefaultValue)
[1896] at Microsoft.SqlServer.Management.Smo.PropertyCollection.RetrieveProperty(Int32 index, Boolean useDefaultOnMissingValue)
[1896] at Microsoft.SqlServer.Management.Smo.PropertyCollection.GetValueWithNullReplacement(String propertyName, Boolean throwOnNullValue, Boolean useDefaultOnMissingValue)
[1896] at Microsoft.SqlServer.Management.Smo.Information.get_MasterDBPath()
It turned out my versions of the CLR/NCLI/SMO were 10.50.1600.1.
Upgrading them to 10.53.6000.34 fixed it - thus allowing the 2008R2 SMO to do many things with 2012 and 2014 servers.
Get them from the feature pack
https://www.microsoft.com/en-gb/download/details.aspx?id=44272
I found an issue with Diagram and Schema in SQL-Server 2016 that could be useful to the subject.
I was editing diagram (related to, and with lot of tables of, the "sales" schema) and added a new table, BUT forgot to declare it schema, so it was with the default "dbo". Then when I returned to, and opened up, the schema "sales" and tried to add an existent table... Bluf! THAT Triggered exactly the same error described in that thread.
I even tried the workaround (drag the table) but it didn't work. Suddenly I noticed that the schema was incorrect, I updated it, tried again, and Eureka! the problem was immediately away... Regards.
It's very old problem with cashed content. MS planning to remove diagrams from SSMS, so they don't care about this. Anyway, solution exists.
Just close Diagrams tab and open it again. Works with SSMS 18.2.
You have to use latest version with SSMS
You can check latest builds via this page
https://sqlserverbuilds.blogspot.com/
I'm trying to get the version of SQL Server 2008 and above version using WMI, I'm using the class of ComputerManagement10 and the query of
select PropertyStrValue
from SqlServiceAdvancedProperty
where PropertyName = \'VERSION\' and ServiceName =\'MSSQL$SQL2008R2SP1'\'
where ServiceName is the instance of the SQL Server.
I experience a strange problem that the expected result (PropertyStrValue field) I get is different from the regular select ##version or the "Right click -> Properties" (of sqlservr.exe)
The version WMI gets is "10.51.2500.0" while the original one is "10.50.2500.0"
I checked more than twice to be sure that this is the correct instance, SQL Server, host, etc, but it seems that I am not the only one who experienced this sort of thing.
Does anyone know why is this behavior happening and how to fix it ?
Does anyone know if it's reliable to use WMI to retrieve the version of SQL Server ?
Thanks in advance.
I can't comment on using WMI, but the value from select ##version or better select SERVERPROPERTY('ProductVersion') is correct
Also, are you doing this correctly in the first place?
I want to know the version of SQL Server in my application and your query is useful.
I get the same error !
I find this if you find anything :
Wrong SQL Version
Apparently just an error, but it's good for me
SQL Version list
10.50 / 10.51 => 2008 R2
10.00 => 2008