Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-v3-0324· DeepSeekHugging Face LMArena Human Preference 140K

tldr tsql show create table

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-4.1-mini-2025-04-14’s answer.
  1. User

    tldr tsql show create table

  2. DeepSeek Assistant

    TL;DR: T-SQL Show Create Table Equivalent

    In T-SQL (Microsoft SQL Server), there isn't a direct SHOW CREATE TABLE command like in MySQL, but you can get similar information using these methods:

    Option 1: Using sp_help

    EXEC sp_help 'YourTableName';
    

    Option 2: Using OBJECT_DEFINITION with sys.sql_modules

    SELECT OBJECT_DEFINITION(OBJECT_ID('YourTableName'));
    

    Option 3: Generate Scripts in SSMS

    1. Right-click the table in SQL Server Management Studio
    2. Select "Script Table as" > "CREATE To" > "New Query Editor Window"

    Option 4: Using INFORMATION_SCHEMA views

    SELECT 
        c.COLUMN_NAME, 
        c.DATA_TYPE, 
        c.CHARACTER_MAXIMUM_LENGTH,
        c.IS_NULLABLE,
        CASE WHEN pk.COLUMN_NAME IS NOT NULL THEN 'PRIMARY KEY' ELSE '' END AS KeyType
    FROM 
        INFORMATION_SCHEMA.COLUMNS c
    LEFT JOIN 
        (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 'YourTableName') pk
        ON c.COLUMN_NAME = pk.COLUMN_NAME
    WHERE 
        c.TABLE_NAME = 'YourTableName';
    

    Note: For a complete CREATE TABLE script with all constraints, the SSMS scripting option is most comprehensive.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.