About 334,000 results
Open links in new tab
  1. How do I create a SQL table under a different schema?

    Sep 29, 2009 · If anyone is looking for way to create schema then just execute following script to create schema. create schema [schema_name] CREATE TABLE [schema_name].[table_name]( ... ) ON [PRIMARY] While adding new table, go to table design mode and press F4 to open property Window and select the schema from dropdown. Default is dbo. You can also change ...

  2. SQL server: To create a table inside a schema - Stack Overflow

    Mar 21, 2015 · Create Table HumanResources.T1 (...); In your attempt, you are trying to add it to a database called HumanResources and to the schema dbo. It's database.schema.object. Edit. In response to the OP's comment, the question has already been answered here: How do I create a SQL table under a different schema?

  3. What is the difference between a schema and a table and a …

    Apr 25, 2017 · Deleting a schema: Removing all contents of a room. There are other rooms with contents (other schemas with stored data) Deleting a table: Removing contents of a closet or table inside a room (schema) of the complete house (database). So, in this room (schema), there are other tables, closet with contents stored in them.

  4. How can I show the table structure in SQL Server query?

    Aug 18, 2013 · For SQL Server, if using a newer version, you can use. select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='tableName' There are different ways to get the schema. Using ADO.NET, you can use the schema methods. Use the DbConnection's GetSchema method or the DataReader'sGetSchemaTable method.

  5. sql - CREATE TABLE [dbo]. [Table] - what does the dbo part mean ...

    That is the Schema that the table is being placed in. This is not actually required as dbo is the default schema and any objects referenced without schema specified are assumed to be in dbo. If you were to create your own schema eg: CREATE SCHEMA [MySchema] AUTHORIZATION [dbo] You would then have to reference any objects in it as [MySchema ...

  6. sql server - How do I create a table based on another table - Stack ...

    Aug 15, 2013 · In SQL Server you can use this query to create an empty table: SELECT * INTO {schema_name}.newtable FROM {schema_name}.oldtable WHERE 1 = 0; (If you want to make a copy of the table including all of the data, then leave out the WHERE clause.)

  7. sql server - Create table (structure) from existing table - Stack …

    Mar 24, 2010 · Qutbuddin, 1=2 will prevent data copying from source to destination table. Try yourself:- CREATE TABLE Table1 ( Id int , Name varchar(200) ) INSERT INTO table1 VALUES (1,'A') INSERT INTO table1 VALUES(2,'B') -- Will create table2 with data in table1 SELECT * INTO Table2 FROM Table1 WHERE 1=2 -- Will create table2 without data in table1 SELECT * INTO Table2 FROM Table1 WHERE 1=2

  8. sql - Copy table structure into new table - Stack Overflow

    Aug 3, 2009 · pg_dump dbname -s -t table_to_clone > /tmp/temp.sql Than sed or vim of the file to change the table name and related stuff. Often is enough to replace table_to_clone with table_new_name. At creation, I usually prefix with table name indexes and triggers, so at this point I have nothing more to do. Now, from psql: begin work; \i /tmp/temp.sql

  9. scripting - In SQL Server, how do I generate a CREATE TABLE …

    Here's the script that I came up with. It handles Identity columns, default values, and primary keys. It does not handle foreign keys, indexes, triggers, or any other clever stuff.

  10. SQL Server - Give user permission to create table in their own …

    Oct 29, 2020 · Msg 262, Level 14, State 1, Line 1 CREATE TABLE permission denied in database 'class_DB'. It looks like create table permissions is on a DB level, not the schema level. Is there a way to authorize create table permissions on the schema level? I hope this all makes sense. Again, I am not a DBA, so any help would be appreciated. Thanks!

Refresh