Unitll couple of days before, every thing was working and today "Create Unit Test" option in the Database schema view is greyed out. I have checked all the references and are in place properly. Any suggestions please?
There must be some issue with the sql file that you are using. Check the Error List for Warnings/Error. One of the most probable reason for this could be that you might have specified [Database].[Schema].[Object] in one of the store procedure. To solve this just use[Schema].[Object] instead of [Database].[Schema].[Object].
eg use
dbo.MyStoredProc instead of MyDatabase.dbo.MyStoredProc
Related
I was trying to copy and paste some queries and noticed that the paste option is not working. After that I realized that my copy, paste, delete and next line option is not working at all. What will be the reason for this issue.
When you press the Ctrl key, the text editor is looking for a mouse click to "Go to Definition".
Tools>Options>Text Editor>General> Uncheck "Enable mouse click to perform Go To Definition"
(or you can change the modifier key to something you use less often if you want to continue using this feature)
What, exactly, are you trying to copy, and from where? For instance, if you're attempting to copy and paste tables, views or stored procedures (etc) in the Object Explorer, you'll have no luck.
For most of these items, you should be able to right-click, select "Script [Table | View | Stored Procedure ] As > CREATE TO > New Query Editor Window", then run the script.
Unfortunately(?), SSMS isn't as easy going as Microsoft Access, there's definitely a little work involved.
just experienced the same situation in SSMS v18.5!
Also wasn't able to paste/copy code in the Query's Window.
After playing around and restarting the App it wouldn't work.
I did not have issues copying/pasting in all other applications.
Then I found a solution myself by simply thinking about how to "re-init" the engine of Copy/Paste in SSMS:
Go to: Tools | Options | General | Check "Apply Cut or Copy to blank lines when there is no selection".
After applying the "fix" you should be able to copy/paste again! You may reset the checkmark later.
Hope you other guys have the same luck!
Edit: A few hours later the Copy/Paste again was not working and the fix did not work. I found out that a separate instance of Visual Studio had the same copy/paste problem. So it may be either a Windows 10 or .NET problem.
A reboot helped me in that case.
I encountered this problem too, and got a message saying my pc was out of memory. This could be caused by too many apps being open or too many background processes running.
Simply restarting the pc resolved the problem.
Working with VS2013 and doing my first database project solution. I have three existing databases on the same server. Quotes, Quoting and QuotingUi. Each have a few stored procedures that reference one of the other databases. This is done with database.schema.table (Quotes.dbo.Mytable) syntax and works well in SSMS and all production situations. QuotingUi has a number of views that pull data from Quoting using the same syntax. SPs and EF models have no problem with this.
I have created an empty solution and then added each database to the solution as a project by right clicking on the database in the SQL Object Explorer and Create New Database. Once all three projects are created the solution builds. I do however have warnings on Quotes and Quoting (sps only) that references cannot be resolved to the other database. In QuotingUi I have not only warnings about the sp references but errors (red squigglies) on all the views.
I have tried adding the other projects to each project both as projects (seems it only wants dlls) or databases or both, then rebuild, then close and reopen solution etc. I have set a build dependency for QuoutingUi for the other two projects and a build order that builds them first. No joy.
Have begun Deborah Kurata Pluralsight Course but I do not believe she covers this scenario.
Suggestions welcome.
It sounds like you're still using the existing three part name (e.g. [SameServerDb].[dbo].[Table2]) in your stored procedures and views. You should update it to use the SQLCMD variable name for the reference instead. SQLCMD variables are used so that you could change the referenced database name at deployment time.
This is covered in the help documentation, but here's an example for you. In this case I added a reference to "SameServerDb" as shown below:
Note the "Database Variable" name is $(SameServerDb). Now I just change any reference from [SameServerDb] to [$(SameServerDb)]:
CREATE VIEW [dbo].[View2]
AS SELECT * FROM [$(SameServerDb)].[dbo].[Table2]
For all database projects in your solution, add all their referenced databases: In Solution Explorer window, right click References -> Add database reference, and select the other project. Repeat for all referenced projects. Also, make sure you rebuild all projects.
You can also suppress certain warnings:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/9b698de1-9f6d-4e51-8c73-93c57355e768/treat-specific-warning-as-error?forum=ssdt
intellij idea data sources doesn't see existing table in my mysql database, while Netbeans see it.
i've created a table in the database. When i create connection in intellij idea data sources, it sees my scheme, i do select it in "schemas and tables" but then i don't see it in the list.
every schema, but mine's. When i try to connect to it with netbeans or mysql workbench, it's just ok. same story with several databases, with root access, too. any table, but mine's.
what could be wrong?
i see question like mine's here, related to visual studio, no answer.
please, give a good clue
I had the same problem in IntelliJ IDEA 15.
I fixed it by right clicking the data source -> Properties -> Schemas -> Use legacy introspector.
I found the reason of problem for HSQLDB: There is IDEA bug (i have 11.0 version).
Create db with relative path (relative of MODULE), like this:
jdbc:hsqldb:file:db_file/testDBInMemory;shutdown=true;hsqldb.write_delay=false;
f:\TestModule\db_file\
When added it to Data Sources, IDEA recognizes this path as relative of $IDEA_HOME$/bin folder.
f:\Program Files\JetBrains\IntelliJ IDEA 11.0\bin\db_file\
So you have two different data bases. And when JPA updated first, Data Source doesn't see update in other.
WORKAROUND:
use absolute path in file db url.
For the latecomers still experiencing this, Intellij IDEA also has the following features which might help you as they have me:
'Force Refresh' (ctrl + shift + F5): "The Force Refresh action clears the data source information from cache and loads it again from scratch."
'Forget Cached Schema' which clears the schema cache. Does require you to set which schema you want shown again.
Right click your datasource -> Diagnostics -> 'Force Refresh' or 'Forget Cached Schema'
Source: https://www.jetbrains.com/help/idea/cannot-find-a-database-object-in-the-database-tree-view.html
The answer for me was buried in a comment, so I'm posting it here. The symptom for me was seeing an error like this:
Unable to resolve table 'thetablename'
And the table name was highlighted in red.
The following fixes are all ways to trigger IntelliJ to refresh data sources:
CTRL+ALT+Y to refresh the db stuff, or
CTRL+F5, or
Click the database vertical tab on the right, expand, right-click on each DB connection and select 'Refresh'
Kudos to #ice for answering this earlier in a comment. I'm basically just elaborating and making sure this shows up as an answer.
Either the autocomplete in SQL Server Management Studio 2008 is buggy, or I am. Either way, when I try to type this and hit the spacebar:
SELECT TOP
Autocomplete immediately changes it to this (Topics is a table in one of our databases, btw):
SELECT Topics
Is there a way to fix, or at least gracefully work around this?
Unfortunately, no. SSMS Intellisense is a 1.0 product, and is not as feature-rich as many third-party products. You can turn it off OR ignore the suggestion (with the ESC key).
I think all you can do is hit ESC when the intellisense pop-up appears which will cancel any change it makes, or just turn Intellisense off completely by going to Text Editor -> Transact-SQL -> Intellisense.
I know this has been answered already but if you are looking for a tool that is quite useful/helpful try SQL Prompt from Red Gate. I have used this tool for years and found it is a great replacement for the built-in intellisense with plenty of options to allow for the tool help you be more efficient...
Also, you can cheesily add one column empty tables for the most common keywords you have issues with. Then it autocompletes to the table name but context puts it into the right usage.
Going one further you can:
CREATE table [top ] (c bit)
with the space at the end so the auto-complete is perfect.
After you create the object you'll want to hit CTRL-SHFT-R to refresh your Intellisense.
Lucky me, I have to work with Oracle. And packages.
I have a package that a lot of different developers are touching and it's scaring me. Is it possible to put a package inside of Version Control? Is there some kind of software out there that already does this? If not, is there some kind of export procedure? Can I just grab a file off of a file system?
How are they inputting it? The way we used to work at my last job is editing a text file, and loading it with SQL*Plus. You can just put that source file under version control.
The source must be between "CREATE OR REPLACE PACKAGE MYPACKAGE AS" and "END;" followed by a single slash on a line of its own ("/"); and ditto for "PACKAGE BODY" instead of "PACKAGE".
And yes, there's a way to pull the source out of Oracle. It's in a table, line by line, look up ALL_SOURCE and USER_SOURCE. You can pull it out with a query like
SELECT TEXT FROM ALL_SOURCE
WHERE TYPE='PACKAGE BODY'
AND NAME='MYPACKAGE'
AND OWNER='MYPACKAGEOWNER'
ORDER BY LINE
(untested as I no longer have access to Oracle) and ditto for the 'PACKAGE'.
I think it's best to load it again into Oracle using SQL*Plus; make sure to set "SCAN OFF".
We have a database level trigger to capture changes to packages and save the source in a seperate table. It's not as good as version control, but at least you know when something changes and can retrieve it if a later change tramples on it.
You can download sql developer for free: http://www.oracle.com/technology/products/database/sql_developer/files/what_is_sqldev.html. It integrates with subversion and cvs.
There is also a Visual Studio plugin (http://www.oracle.com/technology/tech/windows/odpnet/index.html). I don't know whether you use Visual Studio or not?
Try http://code.google.com/p/oracle-ddl2svn/ version control for Oracle
Take also a look at this link. It's a PHP/mySQL versioning tool which works with any database type and is fairly simple to learn.