Database Schema of StackOverflow database without data - database

I know how to download database schema without data using SSMS, but I need the database schema of Stack Overflow for an analysis. I just want to download the schema without data.

Related

Create a Data Warehouse with the database on SQL Developer

I have a database in SQL Developer which pull data from an ERP tool and I would like to create a Data warehouse in order to connect it then to PowerBI.
It's my first time that I am doing all this process from the beginning so I am not so experienced.
So where are you suggesting to create the Data Warehouse (I was thinking on SSMS) and how can I connect it with PowerBI ?
My Data Warehouse will consist from some View of my tables and some Joins to get some data in the structure that I want since it is not possible to change anything in the DB.
Thanks in advance.
A "data warehouse" is just a database. The distinction is really more about the commonly used schema design, in the sense that a warehouse is often built along the lines of a star or snowflake design.
So if you already have a database that is extracting data from your ERP, there is nothing to stop you from pointing PowerBI directly at that and performing some analytics etc. If your intention is to start with this database, and then clone/extract/load this data into a new database which is a star/snowflake schema, then that's a much bigger exercises.

How to transfer table from one database to another database?

I was working on Azure Data Studio. By mistake I created a table in the system administrator's database. I want to transfer it to another database which is created by me. How can I transfer that table?
With Azure Data Studio, we can't transfer the table to another database directly. Azure SQL database also doesn't support USE statement. And Azure Data Studio doesn't support import or export jobs. The only way are that:
Create the table with data again in user DB again an then delete is
in System administration's database
Elastic query(CREATE EXTERNAL DATA SOURCE,EXTERNAL TABLE) to cross database query the table data in System
administration's database, and then import it to your user DB.
I tested in Azure Data Studio and it works well. Since you can create table in System administration's database, I think you have enough permission to do this operations.
If you can use SSMS, the could be much easier and there are many ways can achieve it. For example:
Ref the blog:
https://blog.atwork.at/post/How-to-copy-table-data-between-Azure-SQL-Databases
#Json Pan provide in comment.
Export the table into a csv file and then import to user DB.
You also can use Elastic query.
Just choose the way you like.

Handling partial database in Visual Studio database project

So we have a SQL Server database that is replicated from a 3rd party vendor's cloud down to our local database. Data in the tables is replicated down continuously from their cloud servers and occasionally they update the full database with new changes to structure. Their schema is the default dbo schema.
For reporting, we've added a second schema (let's call it abc) where we add some additional tables as well as some functions/stored procedures that reference the data in both the abc and dbo schemas. I have set up our abc schema in Visual Studio as a database project and it looks great, however, I can't deploy/publish anything because when it builds, it says it can't find tables that are in the dbo schema. Obviously that's just because we haven't created them in our database project because we've only setup the scripts for our abc schema.
Is there a way to tell Visual Studio to either ignore those errors or to look in the actual database (not the database project) for those tables?
You should be able to create a dacpac of the "base" database, then include that as a database reference using "same database, same server"? That would keep the objects out of your project, but allow you to reference them in your code.

Best way to backup SQL server schema

What is the best way to backup SQL server schema ??
My schema contains (file-groups ,file streams,tables,relations between tables,constraints,users,...)
I want to backup the schema and its related objects, so I can restore it later to the same database or to a different database that has another schema and objects.
I tried using the file-group backup because it has some restrictions (database must be FULL recovery mode, must backup primary file-group and log), but I want to backup only one schema at a time.
Has anyone any idea to backup schema to file (access or any format) or any way.
You may want to review this document from when Microsoft introduced schemas into SQL Server.
The shortest answer is that databases are the unit for backup and recovery. Schemas are the unit for security.
You should back up the entire database, not just one schema.
Unless you have a really large schema, you can just script it.
In SSMS right-click on your database, then select Tasks - Generate Scripts...
There are some dialogue windows to go through, you can select only certain db objects if you prefer. I'm not sure if this covers file-groups or file streams but all the other db objects you mention are covered. You could try it with just one table to see what happens.
Be careful, on the "Set Scripting Options" dialogue, click Advanced and scroll down to "Types of data to script" in the modal window and ensure that "Schema Only" is selected.
You can script the schema, the data or both. If you db contains a lot of data and you try to script that, it will almost certainly cause SSMS to crash. You've said in your comment that you also want to back up data. This is the only way I know to achieve this without backing up all the other schemas in the db.
Most of the other options are self explanatory. The tool will generate a SQL script. You can run it on a empty db to build up the data structure that you scripted (or just one schema if you prefer)
I hope this helps.

Copying just the data from one Database to another

I'm not sure if this is the site for this question or not [if so put in the comment or vote to move it]
How can I copy only the data from one database to another within the same server on SQL Server 2005?
The two databases have the same schema but not the same data.
I'm trying to get the data from one database to another.
I am not able to restore from a snapshot [that screws over the security settings on the database]. I'm not able to use the import data wizard, because that is trying to copy over schema data as well.
redgate SQL Data Compare is one option.

Resources