Showing posts with label developers. Show all posts
Showing posts with label developers. Show all posts

Monday, March 19, 2012

NEWBIE Needs Help automating data from another server

Hi,

I am able to do these actions interactively from SQL 2005 (not developers nor enterprise edition, just using SQL 2005 Mgmt Studio) and want to "script/batch" them so I can have them automatically run at a pre selected time.

First: I am able to delete the table by performing a right click on the table, then click Delete from Mgmt Studio SQL 2005. I verify the table is completely gone with a refresh. (I pulled the code that did this ..... DROP TABLE etc. to Notepad)

2nd: I am able to import the table (again from Mgmt Studio SQL 2005) and have saved this action as a SSIS. Execute the script and "waLa" I have all 17K rows of data. I pulled this create table code into notepad also.

Now I put the code of both of the above actions together (drop table and create table) into one SQL query and execute it. This does not give me the same results of above, instead my table is blank now.

Maybe there is a better way. The business problem I am attempting to solve: I am refreshing the data in a as/400 table weekly. I want that refreshed data to be available in the SQL2005 database without my having to press buttons first thing Monday morning. Can any one help? Thanks in advance.

Below is the Code:

USE [400kas]
GO
/****** Object: Table [dbo].[navar100] Script Date: 09/07/2007 16:09:04 ******/
DROP TABLE [dbo].[navar100]
GO


USE [400kas]
GO
/****** Object: Table [dbo].[Query] Script Date: 09/07/2007 16:12:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[navar100](
[CMPNO] [decimal](3, 0) NOT NULL,
[ARTDT] [datetime] NOT NULL,
[AUDDT] [datetime] NOT NULL,
[ARDDT] [datetime] NOT NULL,
[CCUS#] [decimal](6, 0) NOT NULL,
[CCNAM] [nvarchar](25) NOT NULL,
[CUSNO] [decimal](6, 0) NOT NULL,
[CNAME] [nvarchar](25) NOT NULL,
[SHPNO] [decimal](4, 0) NOT NULL,
[ARRCD] [nvarchar](1) NOT NULL,
[AUDUS] [nvarchar](10) NOT NULL,
[INVNO] [decimal](6, 0) NOT NULL,
[CUSPO] [nvarchar](15) NOT NULL,
[REFNO] [decimal](6, 0) NOT NULL,
[COMNT] [nvarchar](10) NOT NULL,
[SHPPO] [nvarchar](15) NOT NULL,
[AMONT] [decimal](13, 2) NOT NULL,
[AMOUNT] [decimal](24, 8) NOT NULL,
[REMAN] [decimal](13, 2) NOT NULL,
[INREG] [decimal](3, 0) NOT NULL,
[INSAL] [decimal](3, 0) NOT NULL,
[TMCOD] [nvarchar](2) NOT NULL,
[CRHLD] [nvarchar](1) NOT NULL,
[CRLIM] [decimal](13, 0) NOT NULL,
[CRDAY] [decimal](3, 0) NOT NULL,
[TCRCD] [nvarchar](3) NOT NULL,
[TEXRT] [decimal](11, 6) NOT NULL,
[R1RGL] [decimal](13, 2) NOT NULL,
[TAXAM] [decimal](13, 2) NOT NULL,
[TFRTX] [decimal](13, 3) NOT NULL,
[TFRGT] [decimal](13, 2) NOT NULL,
[TSPCH] [decimal](13, 2) NOT NULL,
[SPCST] [decimal](13, 2) NOT NULL,
[IRPFT] [decimal](13, 2) NOT NULL
) ON [PRIMARY]

Instead of dropping and recreating the table, you can just truncate it.

e.g.

Code Snippet

truncate table [400kas];

|||

1) create an ssis package that pulls the the data from the as400 to your table

-execute sql task- truncate table <tableName>

-data flow task to pull data from source to target

2)create a sql server agent job that executes the package, and runs at the time you'd like (ex. everyday at 7am)

Friday, March 9, 2012

newbie can't connect

Windows XP pro, SQL Server 2000 developers edition installed on the =
client computer.
Installed SQL Server using all defaults except changed detination drive =
and folders to D:
Now the server does not run. I get the following error:
SQL Server registration failed...
SQL Server does not exist or access denied.
I'm trying to use "Windows authentication", which I assume means that =
when I log onto my Windows computer that that's the only login =
information that SQL server needs (that's how it seemed to work on my =
notebook).
What do I start to look for to solve this problem?
TIA.Is the SQL Service actually running ? If you run the following from the
command line does it connect
osql -S(local) -E
This assumes you installed a default instance. You can check this by running
Start>Run services.msc
Check for services starting with MSSQL. If you have one called MSSQLServer
then you have a default instance, if the service has a dollar ($) sign in it
e.g. MSSQL$INST01 then you have a named instance and connect like so
osql -S(local)\INST01 -E
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Karl" <kthompson@.pine-grove.com.nospam> wrote in message
news:eER5eb5$DHA.1036@.TK2MSFTNGP10.phx.gbl...
Windows XP pro, SQL Server 2000 developers edition installed on the client
computer.
Installed SQL Server using all defaults except changed detination drive and
folders to D:
Now the server does not run. I get the following error:
SQL Server registration failed...
SQL Server does not exist or access denied.
I'm trying to use "Windows authentication", which I assume means that when I
log onto my Windows computer that that's the only login information that SQL
server needs (that's how it seemed to work on my notebook).
What do I start to look for to solve this problem?
TIA.