Showing posts with label inserted. Show all posts
Showing posts with label inserted. Show all posts

Monday, March 26, 2012

Fetching an id to use in another task

Hi there,

i have a task that has a ole-db destination. it inserts some data to a table. it's always 1 record that is gonna be inserted.after that the task is finished. however i want to use that same record in the followup-task. is there a way to retrieve the id of that specific record.

Please note that the id of the record is an int-identity from sql-server itself.

at the moment i'm fiddling with "remembering" the inserted data and hopefully it will be a 100%match in the next task, but i have a dark feeling it's not 100%.

is there a common way how to approach this?

The simplest way I can see is to use a Execute SQL task in the control flow to retrieve it after the Dataflow that inserted the row is done.

sql

Fetch rows afftected in a table

Hi,
I'm pretty new to this community and here's my query. Lets suppose I have executed a DML query on a table (inserted a single row). The table is not having any identity, date or time fields....just a primary key column. I wish to retrieve the record that I or anybody else inserted last into that table. Or I might even wish to fetch all records inserted into that table in the last 10 seconds. Can anybody here help me out in this case, plz.

Quote:

Originally Posted by dev177

Hi,
I'm pretty new to this community and here's my query. Lets suppose I have executed a DML query on a table (inserted a single row). The table is not having any identity, date or time fields....just a primary key column. I wish to retrieve the record that I or anybody else inserted last into that table. Or I might even wish to fetch all records inserted into that table in the last 10 seconds. Can anybody here help me out in this case, plz.


Yah.
I got the same doubt .is there any to find the time of insertion of a particular row|||

Quote:

Originally Posted by srinit

Yah.
I got the same doubt .is there any to find the time of insertion of a particular row


You could add columns UpdatedByID and LastUpdateDate and set UpdatedByID to be the user's username and set LastUpdateDate to GETDATE() (or just make the default for LastUpdateDate to be GETDATE()).

Fetch data from Multiple SQL Servers

Hi,
I have 10+ SQL Servers, from my head office server i want
to connect to all branch server and execute a sql
statement and results to be inserted into a table of Head
Office Server.
RegardsYou can use a linked server... ( See linked Servers in Books on line.) Set
up a linked server then use the 4 part name
insert into mytable select * from server1.pubs.dbo.titles
etc
Or you could use replication to move the data on a regular basis...
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Asmath" <anonymous@.discussions.microsoft.com> wrote in message
news:1071d01c3f3c4$e43bcdd0$a001280a@.phx.gbl...
> Hi,
> I have 10+ SQL Servers, from my head office server i want
> to connect to all branch server and execute a sql
> statement and results to be inserted into a table of Head
> Office Server.
>
> Regards|||Hi,
In my head office server, i found the list of all branch
server in Security->Remote Servers.
I found no entries in Security->LinkedServers, when i try
to add linked server, error appears already exists?
And how to use authentication process?
>--Original Message--
>You can use a linked server... ( See linked Servers in
Books on line.) Set
>up a linked server then use the 4 part name
>insert into mytable select * from server1.pubs.dbo.titles
>etc
>Or you could use replication to move the data on a
regular basis...
>--
>Wayne Snyder, MCDBA, SQL Server MVP
>Computer Education Services Corporation (CESC),
Charlotte, NC
>www.computeredservices.com
>(Please respond only to the newsgroups.)
>I support the Professional Association of SQL Server
(PASS) and it's
>community of SQL Server professionals.
>www.sqlpass.org
>
>"Asmath" <anonymous@.discussions.microsoft.com> wrote in
message
>news:1071d01c3f3c4$e43bcdd0$a001280a@.phx.gbl...
>> Hi,
>> I have 10+ SQL Servers, from my head office server i
want
>> to connect to all branch server and execute a sql
>> statement and results to be inserted into a table of
Head
>> Office Server.
>>
>> Regards
>
>.
>

Fetch data from Multiple SQL Servers

Hi,
I have 10+ SQL Servers, from my head office server i want
to connect to all branch server and execute a sql
statement and results to be inserted into a table of Head
Office Server.
RegardsYou can use a linked server... ( See linked Servers in Books on line.) Set
up a linked server then use the 4 part name
insert into mytable select * from server1.pubs.dbo.titles
etc
Or you could use replication to move the data on a regular basis...
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Asmath" <anonymous@.discussions.microsoft.com> wrote in message
news:1071d01c3f3c4$e43bcdd0$a001280a@.phx
.gbl...
> Hi,
> I have 10+ SQL Servers, from my head office server i want
> to connect to all branch server and execute a sql
> statement and results to be inserted into a table of Head
> Office Server.
>
> Regards|||Hi,
In my head office server, i found the list of all branch
server in Security->Remote Servers.
I found no entries in Security->LinkedServers, when i try
to add linked server, error appears already exists?
And how to use authentication process?

>--Original Message--
>You can use a linked server... ( See linked Servers in
Books on line.) Set
>up a linked server then use the 4 part name
>insert into mytable select * from server1.pubs.dbo.titles
>etc
>Or you could use replication to move the data on a
regular basis...
>--
>Wayne Snyder, MCDBA, SQL Server MVP
>Computer Education Services Corporation (CESC),
Charlotte, NC
>www.computeredservices.com
>(Please respond only to the newsgroups.)
>I support the Professional Association of SQL Server
(PASS) and it's
>community of SQL Server professionals.
>www.sqlpass.org
>
>"Asmath" <anonymous@.discussions.microsoft.com> wrote in
message
> news:1071d01c3f3c4$e43bcdd0$a001280a@.phx
.gbl...
want
Head
>
>.
>