Why Are My Tables Not Being Created?

May 7, 2008

This procedure runs and I see my GM names come up one at a time but I get no tables created.

Sorry about the sloppy code - I'm not a real pro.

declare @@GM Char(100)
declare @SQL VarChar (2000)
Declare spot cursor scroll for
select GM from BIM_Historical_Performance.dbo.Performance_Master
open spot
fetch first from spot
into @@GM
While @@Fetch_Status =0
BEGIN

set @SQL = 'select Comp, Billto, Cust_name as Customer, Branch, BAC, [MgMt_Type], BondValue as Bondbucks , BondValueAlloc as Allocbucks, c1 as Curcode, u1 as CurUnderP$, s1 as Cur3mthBIMsales, p1 as performance, I1 as Inside, [IS_since] as Insidesince, O1 as Outside, [OS_since] as Outsidesince, c2 as CodeM-1, c3 as CodeM-2, c4 as CodeM-3, c5 as CodeM-4 ,c6 as CodeM-5, GM into ' +@@GM + ' from BIM_Historical_Performance.dbo.Performance_Master where BIM_Historical_Performance.dbo.Performance_Master.gm = ' +@@GM

EXEC (@Sql)
Fetch NExt from spot
End

View 1 Replies


ADVERTISEMENT

Get New Database Created Then Running Script To Created Tables / Relationships

Jun 29, 2015

trying to get a new database created then running a script to created the tables, relationships, indexes and insert default data. All this I'm making happen during the installation of my Windows application. I'm installing SQL 2012 Express as a prerequisite of my application and then opening a connection to that installed SQL Server using Windows Authentication. 

E.g.: Data Source=ComputerNameSQLEXPRESS;Initial Catalog=master;Integrated Security=SSPI; Then I run a query from my code to create the database eg: "CREATE DATABASE [MyDatabaseName]".

From this point I run a script using a Batch file containing "SQLCMD....... Myscriptname.sql". In my script I have my tables being created using "Use [MyDatabaseName]   Go   CREATE TABLE [dbo].[MyTableName] .....". So question is, should I have [dbo]. as part of my Create Table T-SQL commands? Can I remove "[dbo]."? Who would be the owner of the database? If I can remove the [dbo]., should I also remove dbo. from any query string from within my code?

View 3 Replies View Related

Rollback Will Drop Created Tables And Drop Created Tables In Transaction..?

Dec 28, 1999

Hi folks.

Here i have small problem in transactions.I don't know how it is happaning.
Up to my knowldge if you start a transaction in side the transaction if you have DML statements
Those statements only will be effected by rollback or commit but in MS SQL SERVER 7.0 and 6.5
It is rolling back all the commands including DDL witch it shouldn't please let me know on that
If any one can help this please tell me ...........Please............
For Example
begin transaction t1
create table t1
drop table t2

then execute bellow statements
select * from t1
this query gives you table with out data

select * from t2
you will recieve an error that there is no object

but if you rollback
T1 willn't be there in the database

droped table t2 will come back please explain how it can happand.....................

Email Address:
myself@ramkistuff.8m.com

View 1 Replies View Related

HELP:I Want To Know Who Had Created The New Tables

Oct 31, 2005

I want to know who had created the new tables,How can I achieve it?
Can I know it by using the sysobjects table?

View 7 Replies View Related

No Tables Created....

Feb 20, 2008

Hi everyone.. I have a big problem.. :p

I have created a installer for my application and database.
When I run the installer it only creates the database but no tables created. But in some other workstation it works fine. I dont know what causes this problem....

Please guide me.

RON
________________________________________________________________________________________________
"I won't last a day without SQL"

View 10 Replies View Related

Analyzer And Created Tables

Nov 24, 2000

Can Query Analyzer deal with this or not???

Select FirstName into FirstNameTable From NameTable
Select Count(*) from FirstNameTable

Fails with FirstNameTable as invalid object.
TIA

View 5 Replies View Related

Dynamically Listing Created Temp Tables

Jan 21, 2002

Hi,

I want to create a nested SP which will dump out the results of All Temp Tables that are currently created in the session. The purpose of this is for createing a generic debugging SP which will write the contents of all temp tables to a debug table (when a certain flag is set).

I need to know how to:

- Get a list of all temp tables created
- Get a list from each temp table of the columns created.

Hope someone can help!

Cheers,

Andrew

View 1 Replies View Related

Dropping User Created Tables From Master Db

Aug 25, 2006

Hi,
I have created a bunch of tables in the Master db by mistake.I want to drop those tables.Please tell me away to drop those.

Thanks!!

View 2 Replies View Related

Temp Tables Created In Stored Procedures

Feb 12, 2008

Are they unique to a user/session? Like if 2 users simultaneously run the stored procedure?
TIA!

View 13 Replies View Related

Filter Dynamically Created Data Tables Using Sql Query

May 24, 2008

Hi friendsI have little problem here.I am creating data tables dynamically.I want to filter it using sql query.Suppose,
I have four data tables with the same structure but records may be
different.There are two fields ServiceMethod and Rates.Now I want to filter all tables and want to get match records with the ServiceMethod.Suppose,four records in First table,three records in other three tables,and only two records(Service method) are same in all tables.I
want to that two records by filtering all tables and sum of rates and
want to add matched records in new table and bind dropdownlist.Can any guide me how to filter more than one tables using sql query if data tables are created dynamically?Thanks in advance. 

View 2 Replies View Related

SQL 2012 :: Generate Triggers For Newly Created Tables

Sep 11, 2014

I have many new tables for which i need to write Insert,Update and delete triggers manually. Is there any way to generate triggers script which takes table name as a input parameter and print/generate trigger's script?

View 1 Replies View Related

SQL 2012 :: 2 Replicated Objects (tables) Not Being Created On Subscriber

Sep 10, 2015

I'm in the process of migrating over nearly 900 reports to a replicated server.

I have moved over 100 reports, stored procedures and their dependent objects so far.

I have two tables that are not being applied to the subscriber.

View 9 Replies View Related

Tables Created By SELECT INTO Inherit Parent Table Constraints!

Feb 1, 2008

Hey there,
Trying to build a temporary table based on a parent table such that:select * into #staging from tbl_parent where 1=0
The temp table (#staging) picks up any NOT NULL constraints from the parent (tbl_parent) table and frankly, it doesn't meet my needs.I also tried to build a view of the parent (tbl_parent) table from which to base my SELECT INTO and still, the constraints followed.
I'm thinking perhaps it possble to iterate though the temp table using syscolumns sysobjects and and set the column NULL properties on the temp table AFTER its been created but in this approach, I'm working to avoid directly referencing the columns by name.
Is this possible?  A better answer perhaps?
Purpose of exercie is to populate a record in memory before it hits the table.I'll be constructing the record on the fly so that at first, I won't have all the fields to de-Null the columns.Also, I don't wish to lose the fact that some of my fields are Null - once I've fully populated my temp record, I'll insert into my 'real' table and will depend on constraints to throw the appropriate error.  In this I won't have to built custom error checking in the stored procedure itself but instead depend on SQL SERVERS built capacity to the throw the error.  This opens a bunch of possibilities for extensibility since if at a later date a constraint rule changes, one need only change the parent table definition rather than cracking open the stored procedure.
Thank you for reading and a big thanks to you for replying :)
Also,
 

View 11 Replies View Related

DB Engine :: How To Find List Of Indexes On Tables On Which Views Has Been Created

Aug 28, 2015

The views are in XYZ production database and user needs the list of indexes on the tables on which the views has been created.

query to find list of indexes on the tables on which the views has been created.

View 4 Replies View Related

SQL Server Admin 2014 :: Replication - Subscription Database Created But Tables Not Populated

Nov 6, 2015

As per attachment, i have been created replications but in local subscription it is not populated any thing at the same time, Subscription database has been created but tables is not populated as per publication table.

View 2 Replies View Related

T-SQL (SS2K8) :: Measuring Volume Of Data Created Temporarily To Replace Usage Of Physical Tables In Query

Sep 12, 2014

How I can measure the volume of data created temporarily to replace usage of physical tables in an SQL query.

View 1 Replies View Related

Integration Services :: Loading Tables Created In Previous Sequence Into Local Archive File - SSIS Path Error

Oct 5, 2015

I've been working on an SSIS package trying to load some data and the archive sequence is faulty. I've been trying to load a few tables created in a previous sequence into a local archive file and I've been getting the error "Could not find a part of the path."

The results aren't telling me what it's finding last and so I don't know where to start.

And the source DOES have data in it. It's something between the source and the destination.

View 2 Replies View Related

MSSQL 2005 Inserting Data On Tables Created By Regular Users With Ddl_admin Role, Using Access Or Other Front End Apps

Feb 14, 2008

Writing to tables created by regular users on MSSQL2005

I have users creating tables through an application, I gave them ddl_admin, datareader, datawriter. They can create tables but cannot insert/update data (to their own tables), I cannot insert data either using Access or any other application to those tables created by them (under dbo schema) Is there something I am missing with permissions? Thank you very much

View 3 Replies View Related

Job Created Using SQL DMO Cannot Be Run

Mar 22, 2001

I've created a job using SQL DMO (in VB6) but it fails to run. When try to manual start the job from the Enterprise Manager, it gives error "cannot start job because it does not have any job server(s) defined."

Here is the code :

Dim oSQLServer As New SQLDMO.SQLServer
Dim oJobServer As New SQLDMO.JobServer
Dim oJob As New SQLDMO.Job
Dim oJobSch As New SQLDMO.JobSchedule
Dim oJobStep As SQLDMO.JobStep

oSQLServer.Connect "mc", "sa", ""

oJob.Name = "JOB_Backup"
oSQLServer.JobServer.Jobs.Add oJob

Set oJobStep = New SQLDMO.JobStep
With oJobStep
.Name = "Step 1"
.StepID = 1
.DatabaseName = "master"
.SubSystem = "TSQL"
.Command = "BACKUP DATABASE [medco] TO DISK = 'E:Projectmedco.BAK' With INIT"
.OnFailAction = SQLDMOJobStepAction_QuitWithFailure
.OnSuccessAction = SQLDMOJobStepAction_QuitWithSuccess
End With
oJob.JobSteps.Add oJobStep
oJob.StartStepID = 1

'Set the schedule.
With oJobSch
.Name = "Schedule 1"
.Schedule.FrequencyType = SQLDMOFreq_Daily
.Schedule.FrequencyInterval = 1
.Schedule.ActiveStartDate = "20010315"
.Schedule.ActiveStartTimeOfDay = "150800"
.Schedule.ActiveEndDate = SQLDMO_NOENDDATE
.Schedule.ActiveEndTimeOfDay = SQLDMO_NOENDTIME
End With
oJob.JobSchedules.Add oJobSch

oSQLServer.DisConnect

Set oJobStep = Nothing
Set oJobSch = Nothing
Set oJob = Nothing
Set oSQLServer = Nothing

Something is missing but ?

Thanks for all your helps in advance,
Ben

View 3 Replies View Related

Why Would Tables Pulled In From ODBC In Access Be Different Than Tables In SQL 2005 Tables?

Jan 24, 2008

I'm new to my company, although not new to SQL 2005 and I found something interesting. I don't have an ERD yet, and so I was asking a co-worker what table some data was in, they told me a table that is NOT in SQL Server 2005's list of tables, views or synonyms.

I thought that was strange, and so I searched over and over again and still I couldn't find it. Then I did a select statement the table that Access thinks exists and SQL Server does not show and to my shock, the select statement pulled in data!

So how did this happen? How can I find the object in SSMS folder listing of tables/views or whatever and what am I overlooking?

Thanks,
Keith

View 4 Replies View Related

Need Identity Value Of New Row Created

Jan 6, 2004

I'm buildng an application using the ADO.NET OleDB providor in order to maintain back end compatabiity with both SQL Server and Access Jet4.0. I need to get the Identity key of the new row created as a result of the following insert statement.

OLEDB COMMANT TEXT:
"insert into tblPerson (LastName,FirstName,SSN,BirthDate,Family) values( ?, ?,?,?,?)";

I assume I need to add a select statement immediately following the insert. Can anyone help?

PS - not using stored procedures due to Access jet4.0 limitation

View 5 Replies View Related

How Leave Db With 1 Ldf While It Was Created With 2 Ldf ?

Jan 18, 2002

I want to remove 2 big ldf files (400 mgb and 300 mgb) and start db with only one ldf.
I tried sp_attach_db specifing only mdf file but geting errors
-------
microsoft help PRB: sp_attach_single_file_db Does Not Work for Databases with Multiple Log Files (Q271223)
..... You cannot attach a database that has been created with multiple log files without also attaching all the log files.
----

how can I remove those big ldf files and create new ldf (defult(1mgb)

View 1 Replies View Related

How Can I Know Who Had Created The Table In My DB?

Dec 20, 2005

How Can I know who had created the table in my DB?
May I log it?

View 3 Replies View Related

User Created DBs

Jul 1, 2006

Hi,

How can i get the names of user created databases?

select Distinct (name) from sysobjects where xtype = 'U', i know this statement for tables but is there a statement for Databases?

thanks

View 5 Replies View Related

Cursor Isn't Being Created.

Aug 15, 2007

ElementTypeDep_Cursor seems is not being created in this stored procedure:




Code Snippet
ALTER procedure spCopyTemplateElementTypesToIssues
@TemplateRecno integer,
@ProjRecNo integer,
@IssueRecNo integer
as
declare @ElementTypeRecno integer
declare @ElementTypeDepRecno integer
declare @ProjTypeRecno integer
declare @PreElementRecNo integer
declare @PostElementRecno integer
declare @Count integer
DECLARE element_Cursor CURSOR FOR
SELECT ElementTypeRecNo
FROM dbo.tblTemplateElementType
where TemplateRecno = @TemplateRecNo
OPEN element_cursor
FETCH NEXT FROM Element_Cursor into @ElementTypeRecno
--delete from tblElementCPO
WHILE @@FETCH_STATUS = 0
BEGIN
select @count = count (*)
from tblElementCPO
where ProjRecno = @ProjRecNo
and IssueRecno = @IssueRecno
and TemplateRecno = @TemplateRecno
and ElementTypeRecno = @ElementTypeRecNo
if @Count = 0
begin
insert into tblElementCPO(Ignore, ElementTypeRecno, IssueRecno,
ProjRecno, MaxAttemptNum, IsMileStone, ComponentOnly, Phase,
TaskHoursEst, TemplateRecNo, ChangeDate, ChangePerson)
values (0, @ElementTypeRecno, @IssueRecno,
@ProjRecno, 5,0,6,99,
99,@TemplateRecno, getdate(), current_user)
end
FETCH NEXT FROM element_Cursor into @ElementTypeRecno
END
CLOSE element_Cursor
DEALLOCATE element_Cursor
select @Count = count (*)
FROM dbo.tblElementTypeDep
where TemplateRecno = @TemplateRecNo
if @Count > 0 then
begin
DECLARE ElementTypeDep_Cursor CURSOR FOR
SELECT ElementTypeDepRecNo, PreElementTypeRecNo, PostElementTypeRecno
FROM dbo.tblElementTypeDep
where TemplateRecno = @TemplateRecNo
OPEN ElementTypeDep_cursor
FETCH NEXT FROM ElementTypeDep_Cursor
into @ElementTypeDepRecno, @PreElementRecNo, @PostElementRecno
WHILE @@FETCH_STATUS = 0
BEGIN
select @Count = count (*)
from tblElementDepCPO
where ElementTypeDepRecno = @ElementTypeDepRecno
and PreElementRecNo = @PreElementRecNo
and PostElementRecno = @PostElementRecno
if @Count = 0
begin
insert tblElementDepCPO (ElementTypeDepRecno, PreElementRecNo,
PostElementRecno, ChangeDate, ChangePerson)
values (@ElementTypeDepRecno, @PreElementRecNo,
@PostElementRecno, getdate(), current_user)
end
FETCH NEXT FROM ElementTypeDep_Cursor
into @ElementTypeDepRecno, @PreElementRecNo, @PostElementRecno
END
CLOSE elementTypeDep_Cursor
DEALLOCATE elementTypeDep_Cursor
end


called by
Code Snippet
Dim cnQI02414 As New SqlConnection(My.Settings.csQI02414Dev)
Dim cmd As New SqlCommand
Dim reader As SqlDataReader
cmd.CommandText = "spCopyTemplateElementTypesToIssues"
cmd.CommandType = CommandType.StoredProcedure
Dim spmTemplateRecNo As SqlParameter = _
cmd.Parameters.Add("@TemplateRecNo", SqlDbType.Int)
spmTemplateRecNo.Value = _
Me.cbTemplate.SelectedValue
Dim spmProjRecNo As SqlParameter = _
cmd.Parameters.Add("@ProjRecNo", SqlDbType.Int)

spmProjRecNo.Value = _
Me.cbProject.SelectedValue

Dim spmIssueRecNo As SqlParameter = _
cmd.Parameters.Add("@IssueRecNo", SqlDbType.Int)

spmIssueRecNo.Value = _
Me.cbIssue.SelectedValue

cmd.Connection = cnQI02414
cnQI02414.Open()
reader = cmd.ExecuteReader()
' Data is accessible through the DataReader object here.
cnQI02414.Close()





What should I be looking for?



View 1 Replies View Related

BCP - File Is Not Getting Created

Nov 5, 2007



Hi all,

I have been trying to extract table data into file but its not getting extracted. I am using following command to run.


exec spGetIPAddress @ip = @servername output


select @SQL = 'bcp '

+ char(34)

+ ' select Field from ['

+ @DatabaseName

+ '].[dbo].Temp_ExtractSR39'

+ ' order by Field'

+ char(34)

+ ' queryout '

+ @RenamePathAndFile

+ ' -T -c -CACP -S'

+ @servername


exec master..xp_cmdshell @SQL, no_output

Is there any setting need to be done at database level? or any setting for Sql server?

Thanks in adavance,
Anshu


View 3 Replies View Related

What To Do With Pkgs Once Created In BIS?

Mar 6, 2007

Hi,

I have been in the process of creating some new pkgs in BIS. My question is, once I am done writing the pkgs, what next?

That is, how do I get the pkgs into SQL Server, and how do I schedule them to run?

Also, what if I have the following scenario:

I have created a new SSIS pkg that has several EXECUTE DTS 2000 tasks in them. The DTS packages that are called from the EXECUTE DTS 2000 task are stored in the database under "Legacy". These should still run OK once I "load" the packages to SQL Server 2005, yes?

Where do the SSIS packages "live" in SQL Server 2005? That is, where can I view them.

Thank you!!



View 1 Replies View Related

UDT Not Being Created At Subscriber

Nov 10, 2005

Hi,

View 4 Replies View Related

Database Is Not Being Created

Apr 10, 2006

Hi there.

I have generated an SQL Script to script me a database, stored procs, tables, foriegn keys and users, as well as Create command and drop objects.



however it seems that it is not creating the database, if an existing database does not exist, or if it does after it has been dropped. I get this error:

Could not locate entry in sysdatabases for database 'db_name_something'. No entry found with that name. Make sure that the name is entered correctly.


This is the SQL:

/****** Object: Database SafeHands Script Date: 10/04/2006 02:05:30 ******/
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'db_name_something')

DROP DATABASE [db_name_something]


CREATE DATABASE [db_name_something] ON (NAME = N'db_name_something_Data', FILENAME = N'C:Program FilesMicrosoft SQL ServerMSSQLdatadb_name_something_Data.MDF' , SIZE = 1, FILEGROWTH = 10%) LOG ON (NAME = N'db_name_something_Log', FILENAME = N'C:Program FilesMicrosoft SQL ServerMSSQLdatadb_name_something_Log.LDF' , SIZE = 1, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS

..

..



any ideas where I am going wrong?

I know that I do not have the "GO" command, however I am trying to run the entire script from C# 2.0, using SQL Server 2000 SP4, so I have read the entire script into a string array, and split each line from the word "GO" as otherwise, I would get an error.

Many thanks

View 3 Replies View Related

Dependency Not Created

Dec 5, 2007

--The Dependency row is not created!

-- I have a procedure "Example 1".

-- When I look at the sys.sql_dependencies I didn't find a row with Table1 dependency.

--If I write the procedure like "Example 2" the dependency Table1 exists in sys.sql_dependencies.

--

--DEFENENTLY A BUG. CAN YOU FIX IT?

--I REALLY NEED IT!!!!!!



Create table Table1 (id int);

GO

--Example 1

CREATE procedure a

as

create table #Test(id int)

Insert into #test

Select id from Table1

DROP TABLE #test;

GO

Select * from sys.sql_dependencies where object_id=object_id('a');

GO

--Example 2

CREATE procedure c

as

Select id into #test from Table1

DROP TABLE #test;

GO

Select * from sys.sql_dependencies where object_id=object_id('c');

DROP PROCEDURE c

DROP PROCEDURE a

DROP TABLE Table1

View 1 Replies View Related

Where Is The Package I Just Created?

Jul 19, 2007

I loaded the import/export wizard into my Tools menu. I ran it and exported a view to an excel worksheet with mixed results (I got the headings, but no data). I want to take a look at the package that should have been created (I selected that option, but the export didn't complete and I couldn't decipher the log to determine whether the package was created).
If it was successfully created, where would I find it in SQL 2005 Express?

Thanks,

Bill

View 12 Replies View Related

Date Created Defualt Value

Jul 1, 2007

 in my database i have a "datecreated" feild, its datatype is "datetime", is it possible to set the defualt value as the time now? if so what do I put in the defualt value property? thanks a million si!

View 2 Replies View Related

How To Notify A DBA When An Object Is Created ?*V *?

Aug 14, 2000

Hi Guys,

Is there a way to notify DBA when a new stored procedure,table,view is created by any user...

Help is greatly appericated..

Jessi..

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved