Showing posts with label process. Show all posts
Showing posts with label process. Show all posts

Thursday, March 29, 2012

Automating Multiple Package execution

Hi,

Can anyone tell me the process of executing multiple packages in SSIS

I have 10 packages which should be executed in an order and should be automatically executed once in a day.

Can someone suggest me any such process which will help me to achieve this

Regards,
Explorer

You can build a main package that integrates the other packages in sequence and then create a job that executes the main package when you want in a schedule.

Regards,

Raul

|||

Hi,

Can anyone tell me the process of executing multiple packages in SSIS

I have 10 packages which should be executed in an order and should be automatically executed once in a day.

Can someone suggest me any such process which will help me to achieve this

Regards,
Explorer

As Raul said, you can achieve this with one master package which in turn calls the other 10 packages in the sequence you desire.

1) Create a new package and add 10 Execute Package Tasks in your Workflow.

2) Configure each Execute Package Task to call the package you want in order to get the right sequence.

3) Schedule a job to run the master package.

sql

Tuesday, March 27, 2012

automating data refresh

Frequently we get request of data refresh. Its curbersome process everytime
to take backup from prod and restore in development/test region. I am
thinking to automate this process using stored procedure. But I need to pass
various parameters to SP to tell where is source, destination, domain, etc.,
Anyone has better ideas/suggestions. Do you have any script reg.
Thanks,
RamuIf you’re using SQL 2005 there are more options obviously with data mirror
and then snapshot. If you want a straight backup and restore then use a
stored proc on the destination server dev or test to use a UNC to grab last
night’s backup file and copy it locally. Then do the restore. Do the copy
with a batch file or better yet a powershell script and then create another
proc that accepts the parameters you need for the restore. Then create a job
with no schedule and give the developers access to the job. The job would
have the step of executing the batch file then executing the restore. You ca
n
also use snapshot replication to refresh dev and test on a schedule when
things are slow, however if you did this make sure the either the dev or tes
t
system are the distributor to offline some of the over head of replication.
If that’s what you want.
John Vandervliet
"Ramu" wrote:

> Frequently we get request of data refresh. Its curbersome process everytim
e
> to take backup from prod and restore in development/test region. I am
> thinking to automate this process using stored procedure. But I need to pa
ss
> various parameters to SP to tell where is source, destination, domain, etc
.,
> Anyone has better ideas/suggestions. Do you have any script reg.
> Thanks,
> Ramu
>|||The "Copy SQL Server Objects Task" in DTS is your tool.
Quentin
"Ramu" <Ramu@.discussions.microsoft.com> wrote in message
news:EDCBFBCD-55C0-44D9-BB19-190EBFBFD7F4@.microsoft.com...
> Frequently we get request of data refresh. Its curbersome process
> everytime
> to take backup from prod and restore in development/test region. I am
> thinking to automate this process using stored procedure. But I need to
> pass
> various parameters to SP to tell where is source, destination, domain,
> etc.,
> Anyone has better ideas/suggestions. Do you have any script reg.
> Thanks,
> Ramu
>

automating data refresh

Frequently we get request of data refresh. Its curbersome process everytime
to take backup from prod and restore in development/test region. I am
thinking to automate this process using stored procedure. But I need to pass
various parameters to SP to tell where is source, destination, domain, etc.,
Anyone has better ideas/suggestions. Do you have any script reg.
Thanks,
Ramu
If you’re using SQL 2005 there are more options obviously with data mirror
and then snapshot. If you want a straight backup and restore then use a
stored proc on the destination server dev or test to use a UNC to grab last
night’s backup file and copy it locally. Then do the restore. Do the copy
with a batch file or better yet a powershell script and then create another
proc that accepts the parameters you need for the restore. Then create a job
with no schedule and give the developers access to the job. The job would
have the step of executing the batch file then executing the restore. You can
also use snapshot replication to refresh dev and test on a schedule when
things are slow, however if you did this make sure the either the dev or test
system are the distributor to offline some of the over head of replication.
If that’s what you want.
John Vandervliet
"Ramu" wrote:

> Frequently we get request of data refresh. Its curbersome process everytime
> to take backup from prod and restore in development/test region. I am
> thinking to automate this process using stored procedure. But I need to pass
> various parameters to SP to tell where is source, destination, domain, etc.,
> Anyone has better ideas/suggestions. Do you have any script reg.
> Thanks,
> Ramu
>
|||The "Copy SQL Server Objects Task" in DTS is your tool.
Quentin
"Ramu" <Ramu@.discussions.microsoft.com> wrote in message
news:EDCBFBCD-55C0-44D9-BB19-190EBFBFD7F4@.microsoft.com...
> Frequently we get request of data refresh. Its curbersome process
> everytime
> to take backup from prod and restore in development/test region. I am
> thinking to automate this process using stored procedure. But I need to
> pass
> various parameters to SP to tell where is source, destination, domain,
> etc.,
> Anyone has better ideas/suggestions. Do you have any script reg.
> Thanks,
> Ramu
>

automating data refresh

Frequently we get request of data refresh. Its curbersome process everytime
to take backup from prod and restore in development/test region. I am
thinking to automate this process using stored procedure. But I need to pass
various parameters to SP to tell where is source, destination, domain, etc.,
Anyone has better ideas/suggestions. Do you have any script reg.
Thanks,
RamuIf youâ're using SQL 2005 there are more options obviously with data mirror
and then snapshot. If you want a straight backup and restore then use a
stored proc on the destination server dev or test to use a UNC to grab last
nightâ's backup file and copy it locally. Then do the restore. Do the copy
with a batch file or better yet a powershell script and then create another
proc that accepts the parameters you need for the restore. Then create a job
with no schedule and give the developers access to the job. The job would
have the step of executing the batch file then executing the restore. You can
also use snapshot replication to refresh dev and test on a schedule when
things are slow, however if you did this make sure the either the dev or test
system are the distributor to offline some of the over head of replication.
If thatâ's what you want.
John Vandervliet
"Ramu" wrote:
> Frequently we get request of data refresh. Its curbersome process everytime
> to take backup from prod and restore in development/test region. I am
> thinking to automate this process using stored procedure. But I need to pass
> various parameters to SP to tell where is source, destination, domain, etc.,
> Anyone has better ideas/suggestions. Do you have any script reg.
> Thanks,
> Ramu
>|||The "Copy SQL Server Objects Task" in DTS is your tool.
Quentin
"Ramu" <Ramu@.discussions.microsoft.com> wrote in message
news:EDCBFBCD-55C0-44D9-BB19-190EBFBFD7F4@.microsoft.com...
> Frequently we get request of data refresh. Its curbersome process
> everytime
> to take backup from prod and restore in development/test region. I am
> thinking to automate this process using stored procedure. But I need to
> pass
> various parameters to SP to tell where is source, destination, domain,
> etc.,
> Anyone has better ideas/suggestions. Do you have any script reg.
> Thanks,
> Ramu
>

Sunday, March 25, 2012

Automatically process a cube which is on another server

Hello

I want to create a DTS package on my server #1 which will process a cube on my server #2. The problem is that when I create the DTS package, I select the "Analysis Services Processing Task" and then, the only choice I have in the left box "Select the object to process" is the local server (server#1). How could it be possible to select my server#2 in that box ?

I know I can create connexions ... could that be part of the solution ?

I'm using SQL SERVER 2000 on server#1 and SSAS2000 on server #2.

Mike

When you're editing a DTS package, I believe the Analysis Services Processing Task will display servers that you've registered in Analysis Manager with your current login profile.

Open Analysis Manager and register the server that you intend to process cubes on, then try the package design again.

Are you logged directly into server #1 or term-served into it? If not, just be aware of the classic problem of DTS package design & deployment. Since Analysis services and DTS package design use live connections, what may work during DTS design time may not work once you, for instance, schedule the package to run as a job step, due to differences in permissions between the developer account credentials versus the account credentials of the service account which SQL Server Agent starts up as.

I hope this helps. I remember suffering through my first DTS package design sessions all too well.

CJB

|||

Enterprise Manager only allows me to register a SQL Server , but the database is on my server#1. My server #2 just has Analysis Services installed, so it is not a SQL Server.

I tried to register my server#1 with the Analysis Manager, and it worked ( I think it's because I have a sample cube on my srever#1), but that didn't change anything.

I still can't do what i need to.

Mike

|||

I think you're looking for the TreeKey setting. It's been so long since I've done DTS and AS2000 that I'm a little rusty. But have a look at:

http://msdn2.microsoft.com/en-us/library/aa902667(sql.80).aspx

Search for "TreeKey" then look at the image above that section. I believe if you set it to "YourServerName\YourCubeName" you should be able to process a cube on another server. I think you'll need a dynamic properties task to accomplish that.

And you might look at:

http://blogs.msdn.com/bi_systems/articles/141632.aspx

|||

thanks for your help, furmangg, but I am not familiar with dynamic properties tasks... What are they ?

And I never used ActiveX scripts, like it is suggested there http://msdn2.microsoft.com/en-us/library/aa902667(sql.80).aspx

Could you give me more detailed explanations, please ?

|||

You need a dynamic properties task to set the TreeKey property of your Analysis Services Processing Task. Here's more on dynamic properties tasks:

http://msdn2.microsoft.com/en-us/library/aa933528(sql.80).aspx

(If there's a UI way to hardcode the TreeKey for the AS Processing Task without a dynamic properties task, then you won't need one.)

I think you'll only need ActiveX script if you don't want to hardcode your TreeKey and want it to be more dynamic like that article suggests.

|||

Ok, I think I understand the problem now.

You can change the treekey setting by entering "Disconnected Edit" mode in the DTS designer. The drawback here is that you won't be able to double click your Analysis Services Processing Task to edit it. But that's okay, since it's not working anyway.

Right click anywhere in the background while designing the DTS package.

A dialog should appear.

Select "Disconnected Edit..."

Expand "Tasks"

Select the Task which is processing the cubes.

A collection of Task properties will show up in the right hand panel. The bottom one is "TreeKey", and its syntax is

servername\databasename\CubeFolder\cubename

So you might edit this to read (note that spaces here are fine, the package will "wrap" them properly at runtime)

mike8srv\FoodMart 2000\CubeFolder\Sales

Inspect the other property values, particularly DataSource (should match the name in Analysis Manager "Data Sources"), Fact table, and ProcessingOption (enumerated list: 0 = full, 1 = refresh, 2 = incremental).

|||

Maybe I was getting close of a solution with furmangg, but with your last post, you really solved my problem John !

I wouldn't have imagined a simpler solution ! Wink

thanks for your help to both of you - i really appreciate

Monday, March 19, 2012

automatic process

I need to automatically generate via SQL, export to Excel and e-mailed
to other people montly. what should I setup in the sql server?Much too vague to do anything but guess at an answer.
One wild idea is a Task that launches Excel which in turn runs a stored
procedure to return the results set into excel. Another task could send the
email with attached file.
Could also run a process from the OS level , running the query output into
excel and then email it.

"TedJM" <ted_gear@.hotmail.com> wrote in message
news:55b4f192.0412011101.15038fe4@.posting.google.c om...
>I need to automatically generate via SQL, export to Excel and e-mailed
> to other people montly. what should I setup in the sql server?|||TedJM,

Take a look at Gadami: http://www.kripsoft.com. It's a program (EXE)
that lets you output the results of one or more SQL queries to Excel
and email them using an available SMTP server.

-Krip|||The best way is to create a DTS package, that uses a query to output a
file with a pre-defined global variable as the path and file anme and
use sql mail to generate an email with an attachment.... And schedule
this DTS in a sql job...!

Sunday, March 11, 2012

Automatic Date Field

Hi, I am in the process of building a table and would
like one of the rows to contain a date time field that
is automatically populated with date/time once the
submit button is hit. I can do this in access with
selecting Data Type = Date/Time and default value
= Date()
SQL ver 2K sp3.
TIA for any pointers
JohnUse GETDATE() OR CURRENT_TIMESTAMP
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Johnny" <use@.stamp.co.uk> schrieb im Newsbeitrag
news:429c1d1f$1_1@.mk-nntp-2.news.uk.tiscali.com...
> Hi, I am in the process of building a table and would
> like one of the rows to contain a date time field that
> is automatically populated with date/time once the
> submit button is hit. I can do this in access with
> selecting Data Type = Date/Time and default value
> = Date()
> SQL ver 2K sp3.
> TIA for any pointers
> John
>|||"Johnny" <use@.stamp.co.uk> wrote in message
news:429c1d1f$1_1@.mk-nntp-2.news.uk.tiscali.com...
> Hi, I am in the process of building a table and would
> like one of the rows to contain a date time field that
> is automatically populated with date/time once the
> submit button is hit. I can do this in access with
> selecting Data Type = Date/Time and default value
> = Date()
> SQL ver 2K sp3.
> TIA for any pointers
> John
Thanks Jens, Unfortunatley that makes the whole column into the same date.
John

Thursday, March 8, 2012

Automated restart of Analysis Services

Hello,

I need to put the Analysis server in local mode only while my jobs process cubes on Saturday morning.

I can script the property but I do not know how to automatically restart the service.

Any idea?

Thanks

Philippe

<Alter AllowCreate="true" ObjectExpansion="ObjectProperties" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Object />

<ObjectDefinition>

<Server xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2">

<ID>SMDEV</ID>

<Name>SMDEV</Name>

<ServerProperties>

<ServerProperty>

<Name>Network\ListenOnlyOnLocalConnections</Name>

<Value>true</Value>

</ServerProperty>

</ServerProperties>

</Server>

</ObjectDefinition>

</Alter>

You can create a simple batch file and use there commands "net start MSSQLSErverOlapservice"

and "net stop MSSQLSErverOlapservice".

Another way, you can write a simple C# application using ServiceController inteface. Take a look here; http://msdn2.microsoft.com/en-us/library/sywbez17.aspx

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Automated creation

Hello,
I was curious if, through code or some other process, if you can automate the creation of a report. I have reports I need generated after a DTS package imports data from the data dictionary. I want the reports in excel format. Is there an automated way of creating these reports? I'm sure there is, but I'm not that familiar with Reporting Services.

Hi bmains

Try using subscriptions with default permissions. You could then output the reports to a share or mail it to users.

,l0n3i200n

Wednesday, March 7, 2012

AUTOMATE PROCESS

Hi

Currentyl after i transfer the data from another database(source) to datawarehouse. I need to click on the "process" button in order to see the latest result. Do it have a command or way to do it programmatically or using the SSIS to do it?

Anyone please point me the link for me to do the automate process ?

Thanks in advance for anyone provide me some clue.

There are plenty of different options

SSIS has an SSAS processing task.

You could script the processing from SSMS as an XML/A command and schedule it from SQL Agent or using the ascmd sample that was released with SP2.

You could write a .Net app using the AMO to initiate the processing.

|||

Hi Darren,

You again Smile . And thank again for the pointing.

And i found more details explaination on this,

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=230156&SiteID=1

Just provide for those are interested. And is worked and simple.

Thanks

|||Yep me again . That's exactly what I had in mind.

automate exporting

Hi,

I have report on an aspx page. If I click a button, I want to automate the exporting process of the displayed report. Is this possible

thanks

Yes, use URLAccess and the rs:Format parameter.

http://msdn2.microsoft.com/en-us/library/ms153586.aspx
http://msdn2.microsoft.com/en-us/library/ms154040.aspx

automate copying access table to sql server 2005 db

I have a table in MS Access that I would like to copy/import into SQL Server 2005. I would like to automate this process so that it copies the table over on a daily basis. Can someone tell me how this can be done?
Thank you in advance.Take a look at DTS packages which you can schedule as a job - nice and easy ;)|||Take a look at DTS packages which you can schedule as a job - nice and easy ;)
I'm sure you meant SSIS :)|||SSIS? I've not come across that acronym before...
I figured for someone new at SQL Server, a scheduled DTS would be the easiest solution...|||DTS is with 2000,
SSIS is with 2005|||In 2005 (Server Management Studio)
Select database
> Management
> Legact
> Data Transformation Services
*confused*|||key word is "Legacy" here. the new ETL component in 2005 is SSIS, it's been completely re-architected.|||How do I use SSIS exactly to accomplish my task (see orig question posted).

Thanks.|||How do I use SSIS exactly to accomplish my task (see orig question posted).

Thanks.

Use SSMS. Right-click the database to which you want the data imported. Select Tasks | Import Data. Follow through the wizard and be sure to save the SSIS package to your DB server.

Then you will need to create a scheduled job to run the SSIS package on whatever schedule you want.

Notes:
If the Access db is located on a server other than the DB server, you'll need to use UNC paths (and probably an ODBC link, but it's been a while since I've had to use Access)

SSIS is a separate component of the SQL 2005 installation. If you have not installed it, it won't be available to you.

Regards,

hmscott|||That was the answer I was looking for. I created a SSIS Package and created a job for it. Seems to work nicely. Thanks again!

Saturday, February 25, 2012

Auto-Increment of varchar primary key

Hi All
I am looking for a bit of advice.
I am in the process of creating a database in which it has been decided that
all primary keys are going to varchar(40). Not my decision, but anyway.
When inserting into each table it will be possible to specify a value for
the primary, but if not specified a value should be auto-generated. That
means that the values in the primary key field can be a mixture of both
numbers and letters, but if auto-generated it should just be a number.
What be the best way to make this autogenerated values if no value is being
specified in the insert?
TIA
KlausDepends really, if auto-generated does it just need to be a number? Any old
number, or a specific format and range?
I always recommend putting a surrogate key on the tables and use that as the
foriegn key and inside the application (not for display purposes, but for
use as the value in a listbox for instance), that can be a int column with
the IDENTITY property, not null and have a unique constraint on it.
You could set the value of the primary key to that if not specified, that
would save calculating a new unique number.
Otherwise, you could use an 'instead of' trigger, for example...
Instead of using MAX, you could take the value from a table that holds the
last number used.
create table testtrg (
mycol int not null unique
)
go
insert testtrg ( mycol ) values ( 1 )
go
create trigger trgTestTrg on testtrg instead of insert
as
begin
if @.@.rowcount = 0
return
declare @.nextid int
begin tran
set @.nextid = ( select max( mycol )
from testtrg with (tablockx) )
set @.nextid = isnull( @.nextid, 0 ) + 1
insert testtrg values( @.nextid )
commit tran
end
go
-- Note, inserting 1 but it already exists so should give a key violation,
-- but the instead of trigger code kicks in and gives the next id.
select * from testtrg
insert testtrg ( mycol ) values( 1 )
select * from testtrg
insert testtrg ( mycol ) values( 1 )
select * from testtrg
insert testtrg ( mycol ) values( 1 )
select * from testtrg
go
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"Klaus" <Klaus@.discussions.microsoft.com> wrote in message
news:FE28E558-F88F-4A9F-9AAA-40837A9966E9@.microsoft.com...
> Hi All
> I am looking for a bit of advice.
> I am in the process of creating a database in which it has been decided
> that
> all primary keys are going to varchar(40). Not my decision, but anyway.
> When inserting into each table it will be possible to specify a value for
> the primary, but if not specified a value should be auto-generated. That
> means that the values in the primary key field can be a mixture of both
> numbers and letters, but if auto-generated it should just be a number.
> What be the best way to make this autogenerated values if no value is
> being
> specified in the insert?
> TIA
> Klaus
>|||Thanks a lot, Tony. That was very helpfull.
I will create a unique field on each of my tables. The value for this will
be auto-generated using identity. A trigger will then keep an eye on the
inserts. If no value is being specified for the Primary key, the Identity
value will be copied into the varchar(40) primary key field.
-- Klaus
"Tony Rogerson" wrote:

> Depends really, if auto-generated does it just need to be a number? Any ol
d
> number, or a specific format and range?
> I always recommend putting a surrogate key on the tables and use that as t
he
> foriegn key and inside the application (not for display purposes, but for
> use as the value in a listbox for instance), that can be a int column with
> the IDENTITY property, not null and have a unique constraint on it.
> You could set the value of the primary key to that if not specified, that
> would save calculating a new unique number.
> Otherwise, you could use an 'instead of' trigger, for example...
> Instead of using MAX, you could take the value from a table that holds the
> last number used.
> create table testtrg (
> mycol int not null unique
> )
> go
>
> insert testtrg ( mycol ) values ( 1 )
> go
>
> create trigger trgTestTrg on testtrg instead of insert
> as
> begin
> if @.@.rowcount = 0
> return
>
> declare @.nextid int
>
> begin tran
>
> set @.nextid = ( select max( mycol )
> from testtrg with (tablockx) )
>
> set @.nextid = isnull( @.nextid, 0 ) + 1
>
> insert testtrg values( @.nextid )
>
> commit tran
>
> end
> go
>
> -- Note, inserting 1 but it already exists so should give a key violation
,
> -- but the instead of trigger code kicks in and gives the next id.
> select * from testtrg
> insert testtrg ( mycol ) values( 1 )
> select * from testtrg
> insert testtrg ( mycol ) values( 1 )
> select * from testtrg
> insert testtrg ( mycol ) values( 1 )
> select * from testtrg
> go
>
>
> --
> Tony Rogerson
> SQL Server MVP
> http://sqlserverfaq.com - free video tutorials
>
> "Klaus" <Klaus@.discussions.microsoft.com> wrote in message
> news:FE28E558-F88F-4A9F-9AAA-40837A9966E9@.microsoft.com...
>
>|||The second part of Tony's point should not be lost. You should use that int
key as the FK for relationships with other tables. If you need to show your
client the benefit of using an int instead of a varchar(40). Load up a
couple of tables with some test data. Perform join's using varchar(40) as
the keys and then the same using int as the key. The performance difference
is noticable.
So use an int (or even bigint) PK, put a unique constraint on the
varchar(40) column and for all business logic purposes, the varchar(40) fiel
d
is the "key". But behind the scenes in the database the far more efficient
int is the key.
John Scragg
"Klaus" wrote:
> Thanks a lot, Tony. That was very helpfull.
> I will create a unique field on each of my tables. The value for this will
> be auto-generated using identity. A trigger will then keep an eye on the
> inserts. If no value is being specified for the Primary key, the Identity
> value will be copied into the varchar(40) primary key field.
> -- Klaus
> "Tony Rogerson" wrote:
>|||Also, if you need the data in a varchar(40) field you can use a calculated
column (if they dont need to enter it).
I concurr with Tony & John, if you're doing joins, definately use the INT
field as the joining field, joining on varchar fields gets very slow at
medium to high data volumes.
create table ( id int identity(1,1) primary key , myPK AS cast( ID as
varchar(40)) )
"John Scragg" <JohnScragg@.discussions.microsoft.com> wrote in message
news:EDB86798-0F96-415A-9D8D-733ED2E0CA02@.microsoft.com...
> The second part of Tony's point should not be lost. You should use that
int
> key as the FK for relationships with other tables. If you need to show
your
> client the benefit of using an int instead of a varchar(40). Load up a
> couple of tables with some test data. Perform join's using varchar(40) as
> the keys and then the same using int as the key. The performance
difference
> is noticable.
> So use an int (or even bigint) PK, put a unique constraint on the
> varchar(40) column and for all business logic purposes, the varchar(40)
field
> is the "key". But behind the scenes in the database the far more
efficient
> int is the key.
> John Scragg
> "Klaus" wrote:
>
will
Identity
Any old
as the
for
with
that
the
violation,
decided
anyway.
value for
That
both
number.
is

Friday, February 24, 2012

AutoGenerate Table Schema in SSIS

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?SSIS can't handle changing metadata. Once built, it's set. (Unless you edit it and resave it.) Unless you are going to build the package using .Net, I don't believe this is possible.|||

Leo Mwangi wrote:

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?

Are you just wanting to drop and recreate the table, or do you want to populate it with data as well? If you want to populate it, Phil's comment applies. If you just want to drop and recreate the table based on info from a flat file, you could use a script task to read the file, create the appropriate SQL statements to DROP and CREATE the table and store them in variables, then call them from an Execute SQL task.

|||True statement, John!|||I want to drop and recreate them then push data. I think i have a working script which I will be pushing using script task. thanks for the suggestions guys.

AutoGenerate Table Schema in SSIS

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?SSIS can't handle changing metadata. Once built, it's set. (Unless you edit it and resave it.) Unless you are going to build the package using .Net, I don't believe this is possible.|||

Leo Mwangi wrote:

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?

Are you just wanting to drop and recreate the table, or do you want to populate it with data as well? If you want to populate it, Phil's comment applies. If you just want to drop and recreate the table based on info from a flat file, you could use a script task to read the file, create the appropriate SQL statements to DROP and CREATE the table and store them in variables, then call them from an Execute SQL task.

|||True statement, John!|||I want to drop and recreate them then push data. I think i have a working script which I will be pushing using script task. thanks for the suggestions guys.

AutoGenerate Table Schema in SSIS

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?SSIS can't handle changing metadata. Once built, it's set. (Unless you edit it and resave it.) Unless you are going to build the package using .Net, I don't believe this is possible.|||

Leo Mwangi wrote:

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?

Are you just wanting to drop and recreate the table, or do you want to populate it with data as well? If you want to populate it, Phil's comment applies. If you just want to drop and recreate the table based on info from a flat file, you could use a script task to read the file, create the appropriate SQL statements to DROP and CREATE the table and store them in variables, then call them from an Execute SQL task.

|||True statement, John!|||I want to drop and recreate them then push data. I think i have a working script which I will be pushing using script task. thanks for the suggestions guys.

AutoGenerate Table Schema in SSIS

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?SSIS can't handle changing metadata. Once built, it's set. (Unless you edit it and resave it.) Unless you are going to build the package using .Net, I don't believe this is possible.|||

Leo Mwangi wrote:

I have a database that has few tables whose table Schema changes oftenly based on a flat file specification and I wanted to automate the process where I drop the table and recreate it with the new schema using an SSIS package. Any Ideas on how I can achieve this?

Are you just wanting to drop and recreate the table, or do you want to populate it with data as well? If you want to populate it, Phil's comment applies. If you just want to drop and recreate the table based on info from a flat file, you could use a script task to read the file, create the appropriate SQL statements to DROP and CREATE the table and store them in variables, then call them from an Execute SQL task.

|||True statement, John!|||I want to drop and recreate them then push data. I think i have a working script which I will be pushing using script task. thanks for the suggestions guys.

Monday, February 13, 2012

Auto Process Messages in Target Queue

I am little confused with this statement, can please some one clarify!

Create QUEUE ReceiverQueue WITH STATUS = ON,

ACTIVATION ( PROCEDURE_NAME = dbo.process, MAX_QUEUE_READERS = 1, EXECUTE AS 'dbo' )

Does this mean when a message reaches to ReceiverQueue, it will automatically processed by dbo.Process procedure

Create PROC dbo.process As

Begin

DECLARE @.conversationHandle UNIQUEIDENTIFIER

DECLARE @.message_body varchar(100)

DECLARE @.rid int

Begin Transaction;

While (1=1)

Begin

RECEIVE TOP(1)

@.rid = Cast(Convert(Nvarchar(max),message_body) as int)

From ReceiverQueue

If (@.@.RowCount = 0 Or @.@.ERROR <> 0 ) Break

Exec PriceChange.Extract_AS400Data @.rid

End

Commit Transaction;

End

Or do I have to put WAITFOR statement in my stored proc (dbo.Process) to run it continously.

Please guide

Thanks

By WAITFOR I assume you mean WAITFOR (RECEIVE...), not the WAITFOR DELAY.

Both ways are correct, but a small WAITFOR timeout added to the RECEIVE in the loop is more efficient. If you have a small timeout (e.g. 10 seconds) the procedure wil linger around for up to 10 seconds, so new incoming messages within 10 seconds will find it already activated.

You need to receive also the message_type_name columns and check what message type you RECEIVED. There are two built-in message types you procedure should be ready to handle: EndDialog and Error. As it is now, when will receive an EndDialog or Error it will actually call the PriceChange.Extract_AS400Data procedure with the wrong data. The usual way to reac to these two message types is to issue and END CONVERSATION. For this you need to RECEIVE also the conversation_handle column.

Also, you need to think who will END the conversations you use first and when. How are those pricechange mesages sent? Each change is sent as BEGIN DIALOG/SEND, or there is one long lived dialog that sends all changes?

HTH,
~ Remus

|||

Thanks for the detailed reply. My whole intent is to extract AS400 data using SQL server asynchronously.

Users from front end application (ASP.NET 2) sends a request to download certain batches of data. When users submits a request, request is saved into a database table and a requestid is generated. Generated id is sent as message to sender queue which in truns go to receiver queue. The stored proc associated with the receiver queue will execute an try to download data from as400 by reading the request table based on sent id.

Mostly it will be one message and conversation is closed. Then later time another message and conversation is closed.

Please Guide me for the above scanario.

Thanks

|||

1> How will the stored proc download data from AS400? Do you plan to use a CLR assembly with external access permission? If so, note that your outbound connections will be from the sqlservr.exe process which is running as the SQL Server User Account (eg> LOCALSYSTEM, NETWORKSERVICE, etc). Also, you will be using up a thread in the database engine waiting for the data to be fetched from AS400. And you also need to be careful with handling error semantics (what if AS400 is unavailable or there is a network failure while downloading the data).

One solution to the problem of executing in the context of SQL Server database engine is not to use internal activation. You can use external activation as described here (http://rushi.desai.name/Blog/tabid/54/EntryID/7/Default.aspx) so that your services can be written as standalone EXEs that could run as whatever principal you wish and also on a separate machine if desired.

The other solution, is to use a different SQL Server instance for your outbound access. This instance could even be a copy of the free SQL Server Express.

2> "Mostly it will be one message and conversation is closed". If the initiator service sends the message and closes the conversation in the same transaction (i.e. fire-and-forget) you cannot achieve application-level reliability. In order to get reliability, the app must get back some acknowledgment from the target that the message was received and processed. This response message could be as simple as EndDialog. So it is always better for the target to close the conversation first, after it has successfully received the message.

|||

Thanks for the informatin. Data from AS400 is extracted using the LinkedServer feature of SQL2005.

Is it possible to give some example or url reference to achive what's mentioned in the point 2.

Thnaks

Shafiq

Sunday, February 12, 2012

Auto Increment on a Filed in a Table

I have a table with two primary key fileds. I will be running a process to populate the data into the table.For each process the first field is constant and second field is auto increment one.

My statements are insert into select ** from ** type one.

How do I auto increment second filed per run. Any delivered function available or any suggestion Pl.............It would help us answer you question a lot faster if you supplied DDL, sample Data, and the expected result...|||DDL:
Table1-

id: PK
lin_nbr: PK
filed1
field2

Table2-

filed1
filed2
filed3

Data:

insert into table1 (id, lin_nbr, filed1, filed2) (select 'a001', auto incr , field1,filed2 from table2 )

Result in table2 should be

a001 1 abc def
a001 2 ghi jkl
a001 3 xyz gfg|||Make your lin_nbr an identity column and when you insert, insert all but the lin_nbr column. SQL Server will auto-increment that column for you!

Table1-

id_col int not null,
lin_nbr int identity not null,
filed1 varchar(52) null, -- (or not null, whichever suits your purposes)
field2 varchar(52) null -- (same applies)|||I want that increament is based on the another pk. pl have a look at the data below

a001 1 abc def
a001 2 ghi jkl
a001 3 xyz gfg
a002 1 abc def
a002 2 ghi jkl
a002 3 xyz gfg

Friday, February 10, 2012

Auto Import into sql from a Tab Delmited flat file

i was wondering if there was a way to auto import my file everyday and then process the deminsions and cube i have made in the analysis service program

I suggest looking at the integration services feature in SQL 2005 and DTS in SQL 2000.

You could also use BCP or Bulk Insert.

All of these are covered in books online.