I am taking a backup file with schema and data using a backup SQL script. It is updated in the S3 bucket with schema and data also but I want only the schema backup file and directly uploaded into S3 bucket. what is the process?
How to take only schema backup file in SSMS using queries ?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Amit MohantyRank #112 · 20K reputationPosted Sep 6, 2023, 2:12 AM EDT
To generate a schema-only backup script you can use the Generate Scripts wizard in SSMS to create a script that includes only the schema (tables, views, procedures, etc.) without data.
Tasks>Generate Scripts.This will generate a script containing the schema of your database.
Now save the generated script to a local file, such as schema_backup.sql and you can use the AWS CLI to upload the schema_backup.sql file to your S3 bucket:
Mohammad HussainRank #513 · 4.8K reputationPosted Sep 7, 2023, 10:10 AM EDT
Try This...
BACKUP DATABASE databasename TO DISK = 'C:\backup\schema.bak' WITH COPY_ONLY;