How to view schema of Microsoft SQL Server? - tsql

I need a schema of Microsoft SQL Server like in this screenshot:
I created a schema according to Create Schema in SSMS , but I can not view it in Microsoft SQL Server Management Studio.
Databases -> [YourDatabase] -> Security -> Schemas -> (right-click) New schema
Where to view schema?
I go to Security -> Schemas -> myschemaname click on it and appears nothing.
Thanks for help, I am new to Microsoft SQL Server.

Based on screenshot I assume that you want database diagram.
SSMS -> Object Explorer -> Database Name -> Database Diagram-> RC (Right Click) -> New Database diagram -> Add table
More info: Getting started with SQL Server database diagrams

Related

connect to postgresql from enterprise architect

I've Enterprise Architect v12 and I want to use its Database builder in order to create a live connection between it and a postgresql database.
This is what I've done:
I've downloaded and installed PostgreSQL 9.5
During installation I've installed with StackBuilder Npgsql v2.2.4.3-2 and psqlODBC (64 bit) v09.03.0400-1.
I've started pgAdmin III and I can connect to my local database. I've created a new one without problems.
I've created in EA a new project: in technology I've selected Database and Data model: PostgreSQL.
In DataModel -> Tables -> Tables I've added a table Table1 and I've created a column id (varchar and primary key)
In the same table I've added a Datatabase connection Database connection 1.
I double click on Database connection 1 and then I select ODBC based database. Then click OK
At this point I'm not able to select my postgresql database. The data origin window (I don't know if it's the right name I've the italian version of windows) gives me two tabs: File origin data and computer origin data. In the first case inside the postgresql data folder that I've selected during installation I don't find anything useful, while in the second case I can see only Excel files and MS Access Database. If I click on New button I can select the data origin only for the current user and in the list I can't see postgresql (SQL Server, Microsoft paradox, etc).
What I'm doing wrong? How can I read my posgresql database from EA?
Enterprise Architect only connects to 32 bit ODBC datasources.
You can access the 32 bit ODBC manager from within EA from Tools|ODBC Data Sources or directly in windows from c:\Windows\SysWOW64\odbcad32.exe

Redshift SQL Workbench doesnot show Object Explorer

I am relatively new to Redshift but have used the SQL Server Management Studio(SSMS) to work with SQL Server.
Now I have a project with Redshift and am using the SQL Workbench to query the Redshift Cluster.
However I dont find an Object Explorer kind of window on the SQL Workbench interface. Is there such a window on the SQL workbench?
Also, how do i select the active Redshift database on the SQL Workbench?
Used to be pretty simple in SSMS(Select the active database from a drowp down option list), but i am lost when it comes to SQL Workbench?
Thanks!
The comment above from #a_horse_with_no_name is correct. The tab you're trying to find is called "Database Explorer" and it can be opened Tools -> Show Database Explorer.
Credit goes to #a_horse_with_no_name for answering first.

Can I set a default schema for a connection in Oracle sql developer 4?

Is there a way to set the default schema for a Database connection in Oracle SQL Developer version 4+? I see this link for previous versions:
http://www.javaforge.com/project/schemasel
...but I can't figure it out for Oracle SQL Developer version 4.
The way to do this at the tool level would be to run a session startup script.
Create a text file 'logon.sql' with the script "alter session set current_schema = yourschema;"
Save it anywhere - I recommend saving it somewhere in your database install location.
In SQL Developer go to Tools -> Preferences -> Database
Check the box for "Run connection startup script on each new database connection"
Browse and select the above file.
That should make you default to that schema every time you login.

How to export data from SQL Server to PostgreSQL?

I need to export all tables from SQL Server to PostgreSQL.
Try: I tried from SQL Server IDE but at some stage its giving the error about data types are different.
Question:How can I do export of data from SQL Server to PostgreSQL? Is COPY does my job? If yes, then how can I export all tables including records?
You can't export data from MSsql then import to PostgreSql because it is not same syntax, data type, but you can use tool to migration data from mssql to postgreSql,
See more in topic
migrate data from MS SQL to PostgreSQL?
Use https://dbeaver.io/
Create MS SQL and PostgreSQL database connections (login)
Create target tables in PostgreSQL (same structures in MS SQL)
F5 to see new tables
Right-click on new tables -> 'Import Data' -> You will see 'Data Transfer' window
Choose 'Table' type then click 'Next' -> You will see 'Select input object', where you can choose tables from MS SQL connection
Just 'next' and check settings that you need, done :D
First export the schema into a file and run it against PostgreSQL until you've removed all incompatibilities.
You could try to do the same with the data you want to export but you may be better off writing a Python script to migrate it.
There is an absolutely simple way using built-in SSIS tool using Management Studio. You can find the detailed answer here.
Use https://dbeaver.io/ , as An Le mentioned.
After 40 years of DB development, migrating DB data is still a challenge. DBeaver is a free tool to use for data migration. But you still have to migrate the schema.
Exporting data from DBeaver
From contextual menu of your SQLServer database or schema select Tools > Create new Task > Common > Data Export
You will generate SQL insert files or CSV files. For migration between database types use CSV files.
Cons of SQL Server Migration Tool
Unable to migrate rows containing booleans.
Export ended up in errors of migrationg data with Bool columns, complaining that value is not boolean, although both source and destination columns where of boolean type.
Unable to continue with the next tables afer one table migration fails.
SQL Server - A single error stops all migration even for tables that are not related to the initial error.
Configuring the tool over and over again, trying to export your data is a waste of time. SQL Server migration task does not save the configuration of the source and destination connections. And the wizard is not user friendly, spending your time on it is frustrating. I assume the migration project was abandoned for at least 10 years.

Rename SQL Azure database?

How can i rename the database in sql Azure?
I have tried Alter database old_name {MODIFY NAME = new_name} but not worked.
Is this feature available in SQL Azure or not?
Just so people don't have to search through the comments to find this... Use:
ALTER DATABASE [dbname] MODIFY NAME = [newdbname]
(Make sure you include the square brackets around both database names.)
Please check that you've connected to master database and you not trying to rename system database.
Please find more info here: https://msdn.microsoft.com/en-US/library/ms345378.aspx
You can also connect with SQL Server Management Studio and rename it in Object Explorer. I just did so and the Azure Portal reflected the change immediately.
Do this by clicking on the database name (as the rename option from the dropdown will be greyed out)
Connect with SQL Server Management Studio to your Azure database server, right-click on the master database and select 'New Query'. In the New Query window that will open type ALTER DATABASE [dbname] MODIFY NAME = [newdbname].
It's Very simple for now - Connect to DB via SQL Management Studio and Just rename as you generally doing for DB [Press F2 on DB name]. It will allow you to do this and it will immediately reflect the same.
I can confirm the
ALTER DATABASE [oldname] MODIFY NAME = [newname];
works without connecting to master first BUT if you are renaming a restored Azure database; don't miss the space before the final hyphen
ALTER DATABASE [oldname_2017-04-23T09 -17Z] MODIFY NAME = [newname];
And be prepared for a confusing error message in the Visual Studio 2017 Message window when executing the ALTER command
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
You can easily do it from SQL Server Management Studio, Even from the community edition.