Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8609585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:54:56+00:00 2026-06-12T03:54:56+00:00

import pyodbc cnxn = pyodbc.connect(‘DRIVER={SQL Server};’ + ‘SERVER=’ + data.dbConnection()[0] + ‘;’ + ‘DATABASE=’

  • 0
  import pyodbc
  cnxn = pyodbc.connect('DRIVER={SQL Server};' +
                           'SERVER=' + data.dbConnection()[0] + ';' +
                           'DATABASE=' + data.dbConnection()[3] + ';' +
                           'UID=' + data.dbConnection()[1] + ';' +
                           'PWD=' + data.dbConnection()[2])
  cursor = cnxn.cursor()
  cursor.execute(
  """
  CREATE TABLE Persons
  (
  P_Id int,
  LastName varchar(255),
  FirstName varchar(255),
  Address varchar(255),
  City varchar(255)
  )
  """
             )
  cursor.close()
  cnxn.close()

The above code successfully connects to the database. The script also returns no errors when run, however when I go to check if the table was created, there are no tables in the SQL DB at all.

Why is no table created and why is no error returned?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:54:57+00:00Added an answer on June 12, 2026 at 3:54 am

    Each user in MS SQL Server has a default schema associated with it. The configuration details depend on the version of SQL server and it is configured in the Enterprise Manager. I don’t think SQL Management studio has GUI visibility into it.
    You can try querying for it using:

    select default_schema_name
    , type_desc
    , name
    , create_date
    from sys.database_principals
    order by default_schema_name
    , type_desc
    , name
    

    You can also explicitly create tables in a particular schema by prefixing schema name to the table name, i.e.

    create myschema.mytable as...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trid the following code, import pyodbc try: pyodbc.connect('DRIVER={%s};SERVER=%s;DATABASE=%s;UID=%s;PWD=%s' % (driver, server, database, uid,
I have: import pyodbc con_str = "DRIVER={%s};SERVER=%s;UID=%s;PWD=%s;DATABASE=%s" % \ ('FreeTDS','192.168.1.22','myuser','mypass','mydb') con = pyodbc.connect(con_str) cur
#!/usr/bin/env python import csv import pyodbc out_file = file.csv conn = pyodbc.connect(DRIVER={driver};SERVER=servername;UID=user;PWD=pass;DATABASE=data) cursor =
I'm using pyodbc to query to an SQL Server database import datetime import pyodbc
from pandas import DataFrame import pyodbc cnxn = pyodbc.connect(databasez) cursor.execute(SELECT ID, NAME AS Nickname,
Is there any way to connect to an MS SQL Server database with python
I am trying to retrieve data from an SQL server using pyodbc and print
I'm using pyodbc to query a SQL Server 2008 database table with columns of
I'm connection to mssql server through pyodbc, via FreeTDS odbc driver, on linux ubuntu
I am using pyodbc to manage my database connections. I am attempting to connect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.