I got error when using SQL like "explain select * from sstb1", is this supported? or any plan for this?
Related
I have a view in SQL Server named item_movement, now I want to query using Microsoft Query in Excel:
select * from item_movement
But I'm getting this error - why? Is it possible to use Microsoft Query for querying views?
Found out the issue had to use the keyword
use mydbname before query
I am trying implement a paging and sorting repository with a #Query annotation. The query is simple enough:
SELECT DISTINCT(B.batch), B.scanDate, COUNT(B.batchReferenceNumber) as TransactionCount FROM Batch B
My database is SQL Server. The query that is getting generated is:
select
distinct batch0_.BatchNumber as col_0_0_,
count(batch0_.BatchNumber) as col_8_0_
from
BATCH batch0_
order by
batch0_.BatchNumber asc offset ? rows fetch next ? rows only
I get an error: Incorrect syntax near 'offset'.
The reason is "Offset" was not introduced until SQL Server 2012.
Is there any way around this? Or do I need to implement my own repository versus using the interface?
The SQL for the offset/limit clause is generated by your JPA provider.
You might be able to fix this by configuring the correct SqlDialect or if no such dialect is available you may raise an issue with that project.
CREATE INDEX test_index ON cola_markets(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX;
I am creating an index on Oracle Spatial column, following the guidelines here at http://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_objindex.htm#i78196
However, SQL developer keeps complaining about the following error.
That is definitely the right syntax. I confirm that there is no typing mistake by running it on my database.
On the possibility that this is some oddity due to SQL Developer, can you also try and run the command with plain sqlplus ? What do you get ?
Is there a way to execute the following statement from Oracle using a database link to a SQL Server instance without having to create a view on the target instance?
select db_name(), ##SERVERNAME
I have tried
"select db_name(), ##SERVERNAME"#DbLink
but that did not succeed.
Any help would be greatly appreciated
Here:
select dbo.FunctionName#dblink('value') from dual;
But you need to tell the dblink which functions must be available through the dblink. See the manual at: http://docs.oracle.com/cd/E11882_01/server.112/e11050/admin.htm#i1007467
Is there some kind of plug in you can get for Microsoft SQL management studio that will:
1) help you format your sql (configuration, so we can get it to match our codeing guidelines)
2) highlight syntax that does not match our coding guidelines
For example if a tool could format the sql so that all selects look like:
SELECT
tbl1.[ColumnX]
tbl2.[ColumnY]
FROM
tbl1
JOIN
tbl2 ON tbl1.[tbl2ID] = tbl2.[ID]
WHERE
tbl2.[ColumnZ] = 'XYZ'
Also if the tool could highlight situations were there are ON ERROR statements and suggest we use TRY CATCH for example.
Hopefully there are plugins that integrate right into the management studio.
Have you looked at SQL Prompt Pro from Red Gate ? It has layout functionality allowing you to layout your SQL to a shared style.
http://www.red-gate.com/products/SQL_Prompt/index.htm
You might want to check out Toad SQL Server beta
Andy
SSMS Tools is free and has a code layout feature.
I don't know of any static code analyzers for SQL Server. I tend just to search the code:
SELECT * FROM sys.sql_modules WHERE definition NOT LIKE '%BEGIN CATCH%'