No new tables in database after executed query
-
Hi all. I am using Microsoft SQL Server 2008 Management Studio. I have been trying to create a database (containing tables etc) from a query file (Delivery.sql). In the Object explorer I right-clicked Database folder and created the "Delivery database". I then clicked New Query and pasted the contents of Delivery.sql (from notepad) into the new query. Now when I execute this code, it says it has completed successfully, but in the Object Explorer the "Delivery database" does not contain any tables :sigh: . I am confused and am in need of help . Thanks. Here is the image of the object explorer: http://imageshack.us/a/img694/7558/sqlobjectexplorerp.png[^] Here is the code of the query file (Delivery.sql):
USE [Delivery database]
GO/****** Object: Database [Delivery] Script Date: 05/09/2013 19:23:43 ******/
CREATE DATABASE [Delivery] ON PRIMARY
( NAME = N'Delivery', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Delivery.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Delivery_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Delivery_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GOALTER DATABASE [Delivery] SET COMPATIBILITY_LEVEL = 100
GOIF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Delivery database].[dbo].[sp_fulltext_database] @action = 'enable'
end
GOALTER DATABASE [Delivery] SET ANSI_NULL_DEFAULT OFF
GOALTER DATABASE [Delivery] SET ANSI_NULLS OFF
GOALTER DATABASE [Delivery] SET ANSI_PADDING OFF
GOALTER DATABASE [Delivery] SET ANSI_WARNINGS OFF
GOALTER DATABASE [Delivery] SET ARITHABORT OFF
GOALTER DATABASE [Delivery] SET AUTO_CLOSE OFF
GOALTER DATABASE [Delivery] SET AUTO_CREATE_STATISTICS ON
GOALTER DATABASE [Delivery] SET AUTO_SHRINK OFF
GOALTER DATABASE [Delivery] SET AUTO_UPDATE_STATISTICS ON
GOALTER DATABASE [Delivery] SET CURSOR_CLOSE_ON_COMMIT OFF
GOALTER DATABASE [Delivery] SET CURSOR_DEFAULT GLOBAL
GOALTER DATABASE [Delivery] SET CONCAT_NULL_YIELDS_NULL OFF
GOALTER DATABASE [Delivery] SET NUMERIC_ROUNDABORT OFF
GOALTER DATABASE [Delivery] SET QUOTED_IDENTIFIER OFF
GOALTER DATABASE [Delivery] SET RECURSIVE_TRIGGERS OFF
GOALTER DA
-
Hi all. I am using Microsoft SQL Server 2008 Management Studio. I have been trying to create a database (containing tables etc) from a query file (Delivery.sql). In the Object explorer I right-clicked Database folder and created the "Delivery database". I then clicked New Query and pasted the contents of Delivery.sql (from notepad) into the new query. Now when I execute this code, it says it has completed successfully, but in the Object Explorer the "Delivery database" does not contain any tables :sigh: . I am confused and am in need of help . Thanks. Here is the image of the object explorer: http://imageshack.us/a/img694/7558/sqlobjectexplorerp.png[^] Here is the code of the query file (Delivery.sql):
USE [Delivery database]
GO/****** Object: Database [Delivery] Script Date: 05/09/2013 19:23:43 ******/
CREATE DATABASE [Delivery] ON PRIMARY
( NAME = N'Delivery', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Delivery.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Delivery_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Delivery_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GOALTER DATABASE [Delivery] SET COMPATIBILITY_LEVEL = 100
GOIF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Delivery database].[dbo].[sp_fulltext_database] @action = 'enable'
end
GOALTER DATABASE [Delivery] SET ANSI_NULL_DEFAULT OFF
GOALTER DATABASE [Delivery] SET ANSI_NULLS OFF
GOALTER DATABASE [Delivery] SET ANSI_PADDING OFF
GOALTER DATABASE [Delivery] SET ANSI_WARNINGS OFF
GOALTER DATABASE [Delivery] SET ARITHABORT OFF
GOALTER DATABASE [Delivery] SET AUTO_CLOSE OFF
GOALTER DATABASE [Delivery] SET AUTO_CREATE_STATISTICS ON
GOALTER DATABASE [Delivery] SET AUTO_SHRINK OFF
GOALTER DATABASE [Delivery] SET AUTO_UPDATE_STATISTICS ON
GOALTER DATABASE [Delivery] SET CURSOR_CLOSE_ON_COMMIT OFF
GOALTER DATABASE [Delivery] SET CURSOR_DEFAULT GLOBAL
GOALTER DATABASE [Delivery] SET CONCAT_NULL_YIELDS_NULL OFF
GOALTER DATABASE [Delivery] SET NUMERIC_ROUNDABORT OFF
GOALTER DATABASE [Delivery] SET QUOTED_IDENTIFIER OFF
GOALTER DATABASE [Delivery] SET RECURSIVE_TRIGGERS OFF
GOALTER DA
-
Did you refresh the Object Explorer after creation?
Personal Blog: A Software Programmer Twitter: JammoD
Yeah it didnt work. However I realised that this script didnt have any code to create tables so I used a different script with "CREATE TABLE" code in the query and it worked! thanks