I am using SQL Server 2008 Express and Sql Server Management Studio 2008.
I am trying to associate a database table with a new schema.
I have created a new Schema by navigating to Security->Schemas in object explorer. I right clicked on the folder and created a new schema called 'People' and set the owner as db_owner. This new Schema now appears in object explorer.
I would now like to associate a table with this schema. I open the table in design view and click on the drop down list in the table Properties pane which contains the available schemas but my newly created schema is not visible.
I have tried refreshing everything throughout object explorer. Closing design view and reopening etc. but still it isn't there.
Am I doing something wrong?
Can anyone point me in the right direction please?
Sorted... in the most ridiculous way.
Apparently refreshing object browser at every hierarchical level is not sufficient.
I had to CLOSE sql management studio, then re-open it. The list of schemas had then managed to refresh and would allow me to associate my new custom schema with the table.
IMO this is rubbish.
Step 1:
Open New Query(or existing query window). Ctrl+Shift+R in query window. It will refresh the intellisence cache or
Edit > IntelliSense > Refresh Local Cache
Also check if IntelliSense is enabled in
Tools > Options > Text Editor > Transact-SQL > Enable IntelliSense
Step 2:
refresh F5 the Object Explorer.
it worked for me
Similar Answer on stack overflow
I am not following you when you say "open the table in design mode then click on the drop down list". I must be overlooking the list on my SQL Express.
Have you tried to change the schema via TSQL? The command is short:
ALTER SCHEMA "target schema" TRANSFER "source schema"."table name";
GO
Replace target and source schema with your schema names.
Related
I'm connected to my universities' SQL server (Microsoft driver). I've tried using both DataGrip from Jetbrains and DBeaver to connect. Everything seems to be fine when I execute a query, however neither DataGrip nor DBeaver is giving me help with table or column names. In fact, DataGrip keeps telling me "Unable to resolve..." even if I type in the whole name (as I said the query executes just fine). Example screen shot:
I'll be really grateful for any suggestions.
This issue is related to DataGrip's intellisense, a similar issue was posted to IntelliJ's community forms here.
This answer relates to DataGrip 2017.1.5 (is likely applicable to other versions as well):
After creating the initial connection to your server, open the Database tool window using:
(ALT + F1) or
(View -> Tool Windows -> Database).
Listed beneath your server connection you will see a "Schemas..." item, double click it. This will expand into a list of all DB schemas you have access to on that server.
Select the schemas you are interested in, and additionally expand each DB schema to select all child schemas for that DB.
Click the refresh button in the schema selection window to synchronize your settings (two arrows pointing at each other in a circle).
Image of Database Toolbar with DB/Schema selection
If they are DBO owned tables, qualify then as dbo.MyTable. Datagrip seems to want a schema (DBO) for objects in order to use intellisense.
In ViewObject creation wizard (Entity Object), the sql mode(Expert mode, Declarative mode ) is not available in JDEV latest version? Is it intentional ? Or it is possible to add tag declaratively in the ViewObject?
For JDeveloper 12.1.3.0 (and possibly, future releases) you can still add custom queries.
Please read 5.8.1 and 5.8.3 (How to Create a Custom SQL Mode View Object) of the documentation: https://docs.oracle.com/middleware/1213/adf/develop/adf-bc-vo-queries.htm#ADFFD307
In short (5.8.1):
In the Applications window, right-click the package in which you want
to create the view object and choose New and then View Object.
If you have not yet created a database connection for the data model
project, in the Initialize Business Components Project dialog, select
the database connection or choose New to create a connection. Click
OK.
If this is the first component you're creating in the project, the
Initialize Business Components Project dialog appears to allow you to
select a database connection.
In the Create View Object wizard, on the Name page, enter a package
name and a view object name. Select Custom SQL query to indicate that
you want this view object to manage data without the benefit of entity
objects. Click Next. --- Fill in you custom query --- ect.
In short (5.8.3):
To enable custom SQL mode, select Write Custom SQL on the Query page
of the Create View Object wizard. You can also modify the SQL
statement of an existing entity-based view object in the view object
overview editor. In the overview editor, navigate to the Query page
and select Write Custom SQL.
I have a number of views in my SQL Server database.
How do I export these as CREATE VIEW scripts?
I tried to right click the database - script database as - create to - new query editor window, but it doesn't show my my views (or tables even for that matter).
Any ideas?
In SSMS, if you right click the DB -> Tasks -> Generate Scripts... - that will take you through a wizard.
You can run through the wizard and select your DB, then the views as AdaTheDev mentioned or you can right click on each query and generate a script directly.
I prefer another way, because always I edit the views to remove "not necessary script generated SQL syntax" (depends on the point of view :)).
Right click the view, Generate script, CREATE in, new window.
See screenshot below (sorry for german version, but should work anyway).
I tried to right click the db - script database as - create to - new query editor window, but it doesn't show my my views (or tables even for that matter).
The purpose of the menu you mentioned is only to create the empty database, without any tables, views or anything else.
If you want to script anything beyond the empty database, you have to use the wizard already mentioned in AdaTheDev's answer.
Maybe you receive empty page because source of VIEW was encrypted or removed.
In older SQL editions there was a trick - after creating VIEW (SQL Server compiled it) developer could remove source of VIEW statement to protect it from "deassemblation". In current editions there is possibility to encrypt source of VIEW statement.
access is the front end and sql server 2008 is the backend
i am opening the specific table in access. i have no problem editing data in this table using sql server and then displaying the changes in access; however, when i add a new field in sql server, the changes are not reflected in access.
i am opening the table as a datasheet and it is not showing the new field that i added in access. ive opened and closed the file and still doesn't work
anyone know what's going on here?
You might need to refresh the SQL Server table in Access using Linked Table Manager.
I cannot add comment but I like to add...
since it irritates me.
It is the same story not only in MS Access, it is the same in SSMS (MS SQL Server Management Studio, even from the latest MS SQL Server 2008 R2) with its own "native" mdf databases and tables from it.
If to change the content of a table through another window / tab or instance of SSMS (by TSQL, or by interactive editing) then the content shown in already opened for interactive editing table is not updated, though it is updated by non-documented Ctrl+R.
And it is not available in GUI of SSMS (no menu entry, no button, etc.)!!!
Any browser/webapp can be easily configured to update the content but not MS desktop IDE GUI!!!
But if to ALTER TABLE, for ex., to add a column, then already opened tab with table (SSMS) cannot reflect the changes (cannot show altered table, for ex., with added column) even by pressing Ctrl+R.
It is necessary to close tab (window) with table and reopen it
(right-clicking on table in SSMS ObjectExplorer --> Edit tio 200 rows)!!!
I remeber I opened a bug in Microsoft Connect feedback on it and it was closed as this was a feature "by design"!
Still IMHO it is a bug and requires brute force (/ugly GUI actions) to bypass it
This SO Q&A seems to cover similar territory.
Say I already created my database but forgot to save the sql commands do create it.
How could I reverse engineer the code from an already existing database?
I'm using Microsoft SQL Server Express 2008.
You can do this pretty easily by using SQL Server Management Studio (SSMS) - it's available for free if you don't already have it installed.
Connect to the database
Expand out Databases > YourDataBaseName.
Right-click on the database and select the option "Script database as" then "Create To" then finally "File".
That will create the necessary scripts to recreate your database.
To script out all the tables in your database:
Right-click on the database node
Select "Tasks" then "Generate Scripts".
When the wizard appears, click Next.
Select the database. At this point you can check the "Script all objects in the selected database" which does exactly what it says, or if you leave it unchecked you will get the option later in the process to pick which items are scripted.
Click next. Now you're given some scripting options.
I'd suggest scrolling down the list and checking the option to Script Indexes/Script Triggers. You can also script the data if necessary (though I wouldn't do this if you've got a lot of data in your database).
Modify any options you'd like and click Next.
Select the database types you'd like to script (Users/Tables/Views). Click Next.
Now you've got the opportunity to select more specific items. Hit Next and repeat the process of any of your other database types.
Hit next one more time, then select where you'd like the script written to. You get the chance to review your selections.
Click Finish.
Here's a link for the 2008 version SSMS Express 2008
Your RDBMS comes with some sort of "dump" tool that will give you the structure and content of your database, in the form of SQL statements.
As others have mentioned, if you have SQL Management Studio (you should, it's free as part of SQL Server Express). Fire it up, connect to your instance then expand the Database tree.
Right click on your database and select Tasks->Generate Scripts..
Click next, then Next again (which selects all objects in the database by default), pick an output option (defaults as "Save to File"), click next and voila!
If you also want to script the data as well as the schema, in the "Set Scripting Options" window, click on the Advanced button, scroll down to "Types of data to script" (just above the Table/View Options header) and select "schema and data".
[Edit] Tested - The Generate Scripts option exists and works in the (free) 2008 R2 edition of SSMS. See the link in my comment below for the URI for the R2 version.