Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Sunday, March 25, 2012

ActiveX to define presidence

I have a DTS package (SQL2000) which uses ActiveX scripts to check for records with certain criteria in a table. If the certain criteria is met, I want to initiate a child package that preforms a data-extraction. Otherwise move onto the next step which check for a different set of criteria. Currently if the criteria is met, I flag the task as success to dictate moving to one set of steps, otherwise failure & moving onto the next check.

The problem I am realizing, is that if I 'Fail' on of the check steps, subsequent steps furthur down the route that I am directing it to go, do not run. These are other ActiveX tasks that send email, and do furthur analysis.

Why is this the case? Can't you perform a logical check, and based upon the check have a decision to run certain steps? I attempted to use the result 'Main = DTSStepScriptResult_DontExecuteTask', but I must not be using it correctly, because it lists the task as returning failure.

Any help would be great.

Kevin Albrecht

DTS is called "SQL Server Integration Services" in the SQL Server 2005 generation. If you re-post your question in the SSIS forums (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1) the DTS experts that hang out over there could likely answer your question.

Thanks,
Steve

|||Moving thread as per the suggestion to keep in SSIS related forums.|||Don't use success/fail as the flag to move to the next step. Set a variable and use an "Expression" precidence constraint to pick which one to move too.

Monday, March 19, 2012

Active Directory, Terminated Employees

Hello, we have scheduled a nightly refresh into an Employees table in a
database, that receives data from Active Directory. AD is the "authority" o
f
who is an active employee and frees us from manual maintenance of the
Employees table in our DB. However, we want to store information on
employees who resign, retire etc. and don't want orphaned records (this is a
training database storing information on what employees take what classes,
with dates and costs). I'd like to set up some kind of append query but
unlike Access, SQL would not let me append duplicate records. The database
has a termination date field also. Any suggestions would be appreciated.
Thanks, Pancho.Do you want only one row per employee, or one for every change in the
employee data?
Are you only updating the termination date from AD, or are you loading all
of the employee data from AD?
Please include DDL and more detail.
(explained here)
http://www.aspfaq.com/etiquette.asp?id=5006
"Pancho" <Pancho@.discussions.microsoft.com> wrote in message
news:4FBC26F2-F086-4734-8A2B-06CC11525F36@.microsoft.com...
> Hello, we have scheduled a nightly refresh into an Employees table in a
> database, that receives data from Active Directory. AD is the "authority"
of
> who is an active employee and frees us from manual maintenance of the
> Employees table in our DB. However, we want to store information on
> employees who resign, retire etc. and don't want orphaned records (this is
a
> training database storing information on what employees take what classes,
> with dates and costs). I'd like to set up some kind of append query but
> unlike Access, SQL would not let me append duplicate records. The
database
> has a termination date field also. Any suggestions would be appreciated.
> Thanks, Pancho.|||Jim,
We only want one row per employee. To the table structure depicted in the
script below I would ideally like to add a date/time column named TermDate.
If empty the employee would be still active.
Thank you for the etiquette link. The programmer kept default length 255's
on varchars. In reality our EmpNumbers are only 3-4 characters, not 50. In
our employee population, we have some employees who leave to go to college
and then return, and we typically preserve their old employee number, and
reactivate it when they return.
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[Employees]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Employees]
GO
CREATE TABLE [dbo].[Employees] (
[FullName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[LName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[FName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Extension] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[EmpNumber] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Email] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Company] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Department] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
"Jim Underwood" wrote:

> Do you want only one row per employee, or one for every change in the
> employee data?
> Are you only updating the termination date from AD, or are you loading all
> of the employee data from AD?
> Please include DDL and more detail.
> (explained here)
> http://www.aspfaq.com/etiquette.asp?id=5006
>
> "Pancho" <Pancho@.discussions.microsoft.com> wrote in message
> news:4FBC26F2-F086-4734-8A2B-06CC11525F36@.microsoft.com...
> of
> a
> database
>
>|||OK, so you need to add a column to your table:
alter table [dbo].[Employees]
add TerminationDate datetime;
Then you need to update this table on a periodic basis? I have not worked
much with AD in SQL Server, but lets assume you are connected and querying
AD as you would a table. We'll call the "table" ADEmpData, and assume it
has EmpNumber and TerminationDate as columns. Also assume EmpNumber can be
duplicated in AD, but it is the PK (or at least unique) in the Employees
table. If you can explain how you are connecting to AD, someone may be able
to provide more complete code.
Update Employees as Emp
set Emp.TerminationDate = (
select top 1 AD.TerminationDate
from ADEmpData as AD
Where AD.EmpNumber = Emp.EmpNumber
order by AD.TerminationDate
-- the above added just to give consistent results with TOP
)
and exists (select 1
from ADEmpData as AD
Where AD.EmpNumber = Emp.EmpNumber)
-- exists used to only attempt to update values if the emp
-- exists in AD
Note that AD may store term date as a string, not a date type, so you may
have to do some conversion here.
"Pancho" <Pancho@.discussions.microsoft.com> wrote in message
news:79A765A9-80AE-4B80-BD4F-106AB1CB636C@.microsoft.com...
> Jim,
> We only want one row per employee. To the table structure depicted in the
> script below I would ideally like to add a date/time column named
TermDate.
> If empty the employee would be still active.
> Thank you for the etiquette link. The programmer kept default length
255's
> on varchars. In reality our EmpNumbers are only 3-4 characters, not 50.
In
> our employee population, we have some employees who leave to go to college
> and then return, and we typically preserve their old employee number, and
> reactivate it when they return.
> if exists (select * from dbo.sysobjects where id =
> object_id(N'[dbo].[Employees]') and OBJECTPROPERTY(id, N'IsUserTable') =
1)
> drop table [dbo].[Employees]
> GO
> CREATE TABLE [dbo].[Employees] (
> [FullName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
> [LName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [FName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [Extension] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [Description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [EmpNumber] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [Email] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [Company] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [Department] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
> ) ON [PRIMARY]
> GO
>
> "Jim Underwood" wrote:
>
all
a
"authority"
(this is
classes,
but
appreciated.|||Jim,
This is good information and I appreciate the detail. This will probably
work here. Have a nice wend! Pancho.
"Jim Underwood" wrote:

> OK, so you need to add a column to your table:
> alter table [dbo].[Employees]
> add TerminationDate datetime;
> Then you need to update this table on a periodic basis? I have not worked
> much with AD in SQL Server, but lets assume you are connected and querying
> AD as you would a table. We'll call the "table" ADEmpData, and assume it
> has EmpNumber and TerminationDate as columns. Also assume EmpNumber can b
e
> duplicated in AD, but it is the PK (or at least unique) in the Employees
> table. If you can explain how you are connecting to AD, someone may be ab
le
> to provide more complete code.
> Update Employees as Emp
> set Emp.TerminationDate = (
> select top 1 AD.TerminationDate
> from ADEmpData as AD
> Where AD.EmpNumber = Emp.EmpNumber
> order by AD.TerminationDate
> -- the above added just to give consistent results with TOP
> )
> and exists (select 1
> from ADEmpData as AD
> Where AD.EmpNumber = Emp.EmpNumber)
> -- exists used to only attempt to update values if the emp
> -- exists in AD
> Note that AD may store term date as a string, not a date type, so you may
> have to do some conversion here.
> "Pancho" <Pancho@.discussions.microsoft.com> wrote in message
> news:79A765A9-80AE-4B80-BD4F-106AB1CB636C@.microsoft.com...
> TermDate.
> 255's
> In
> 1)
> all
> a
> "authority"
> (this is
> classes,
> but
> appreciated.
>
>|||Glad if I could help.
Please remember to post your final solution so others who have a similar
issue will be able to learn from it.
Also, I am interested in seeing how you handle the AD connection. Thus far
I have only done it via VB.Net and have not connected via SQL Server.
"Pancho" <Pancho@.discussions.microsoft.com> wrote in message
news:84DA9C84-4201-4766-9ADC-FD74F3EB5DED@.microsoft.com...
> Jim,
> This is good information and I appreciate the detail. This will probably
> work here. Have a nice wend! Pancho.
> "Jim Underwood" wrote:
>
worked
querying
it
be
able
may
the
50.
college
and
=
NULL ,
,
NULL ,
the
loading
in
the
on
query|||We use a scheduled DTS package to import a .csv file. The .csv file is
exported nightly using a scheduled .bat file that calls a .vbs script that
performs the export from AD. We're not going to implement the TermDate just
yet but I will post the outcome when we do. Thanks again, P.
"Jim Underwood" wrote:

> Glad if I could help.
> Please remember to post your final solution so others who have a similar
> issue will be able to learn from it.
> Also, I am interested in seeing how you handle the AD connection. Thus fa
r
> I have only done it via VB.Net and have not connected via SQL Server.
>
> "Pancho" <Pancho@.discussions.microsoft.com> wrote in message
> news:84DA9C84-4201-4766-9ADC-FD74F3EB5DED@.microsoft.com...
> worked
> querying
> it
> be
> able
> may
> the
> 50.
> college
> and
> =
> NULL ,
> ,
> NULL ,
> the
> loading
> in
> the
> on
> query
>
>|||You might check out microsoft.public.active.directory.interfaces to see if
you can use a more direct approach. I believe SQL Server allows you to
query AD directly, which could eliminate the need for the VBS, BAT, CSV,
etc. I do not know how much is implemented in 2000 VS 2005, but I think I
have seen some examples in this forum.
"Pancho" <Pancho@.discussions.microsoft.com> wrote in message
news:931B3577-C055-4184-AEF5-AC0D22D9652E@.microsoft.com...
> We use a scheduled DTS package to import a .csv file. The .csv file is
> exported nightly using a scheduled .bat file that calls a .vbs script that
> performs the export from AD. We're not going to implement the TermDate
just
> yet but I will post the outcome when we do. Thanks again, P.
> "Jim Underwood" wrote:
>
far
probably
assume
can
Employees
be
you
depicted in
length
not
number,
N'IsUserTable')
NOT
,
,
NULL
NULL ,
,
NULL ,
NULL
in
table
of
information
records
what
The

Active Directory Users Synch with SQL2K table

Hello,
Would anyone know of/recommend a product/site that would be able to
help in a synchronization between the contents of the Active Directory
Users into an SQL table?
Has there been anything written for this?
Thank,
Scott
Scott,
See if this helps..
'OLE DB Provider for Microsoft Directory Services'
http://msdn.microsoft.com/library/en...asp?frame=true
Dinesh
SQL Server MVP
--
SQL Server FAQ at
http://www.tkdinesh.com
"Scott" <shammer125@.hotmail.com> wrote in message
news:f1a31f2.0405210708.543f364b@.posting.google.co m...
> Hello,
> Would anyone know of/recommend a product/site that would be able to
> help in a synchronization between the contents of the Active Directory
> Users into an SQL table?
> Has there been anything written for this?
> Thank,
> Scott

Active Directory Users Synch with SQL2K table

Hello,
Would anyone know of/recommend a product/site that would be able to
help in a synchronization between the contents of the Active Directory
Users into an SQL table?
Has there been anything written for this?
Thank,
ScottScott,
See if this helps..
'OLE DB Provider for Microsoft Directory Services'
]
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
[url]http://www.tkdinesh.com" target="_blank">http://msdn.microsoft.com/library/e...ww.tkdinesh.com
"Scott" <shammer125@.hotmail.com> wrote in message
news:f1a31f2.0405210708.543f364b@.posting.google.com...
> Hello,
> Would anyone know of/recommend a product/site that would be able to
> help in a synchronization between the contents of the Active Directory
> Users into an SQL table?
> Has there been anything written for this?
> Thank,
> Scott

Active Directory Users Synch with SQL2K table

Hello,
Would anyone know of/recommend a product/site that would be able to
help in a synchronization between the contents of the Active Directory
Users into an SQL table?
Has there been anything written for this?
Thank,
ScottScott,
See if this helps..
'OLE DB Provider for Microsoft Directory Services'
http://msdn.microsoft.com/library/en-us/acdata/ac_8_qd_12_94fn.asp?frame=true
--
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Scott" <shammer125@.hotmail.com> wrote in message
news:f1a31f2.0405210708.543f364b@.posting.google.com...
> Hello,
> Would anyone know of/recommend a product/site that would be able to
> help in a synchronization between the contents of the Active Directory
> Users into an SQL table?
> Has there been anything written for this?
> Thank,
> Scott

Active directory Update

Hi!
I want to write a trigger that add a new computer account in my active directory when I do an Insert in my MSSQL table.

I know how to use SELECTstatements using LDAP but I want to do a INSERT statement. Is that even possible?
Can you write vb code directly in SP i mssql 2000?

What I think I have to do is to have a vbscript that does the adding then call the script using exetended SP cmd execute passing the name to the script.

If someone has a another solutions please let me know!

Regards..I've written simple ActiveX out-of-process OLE servers using VB. This is not hard to do. But I think you're going from the wrong direction. I'd rather add a computer account using LDAP from my VB code and then fire a stored procedure to update whatever you want to update. The other way around is possible too, but it doesn't make it easier, not does it make it right either.

Active directory linked server access!

I got a linked server to retrieve information from our Active Directory. Using a stored procedure that accesses the linked server I update a table. The procedure works!

But when I try to run it from a task, it does not work.

Does someone know, which permission has to be configured and where?

Depending on the impersonation defined on the linked server, the service account running SQL Server Agent needs to have access to the Active directory information. Normally this is done by using a domain account as the service account for SQL Server Agent.

Jens K. Suessmeyer

http://www.sqlserver2005.de

Sunday, March 11, 2012

Active / Active Cluster SQL Query

I have a SQL Server 2000 with SP3 in a Active / Active
Cluster. I would like to write a SQL query to receive
database table data from the other side of the Active
cluster.
Node A - Virtual Server Name: HGFOPKLD\ERT - Database
Name: NewOrleans_Sales - Table - June_2004
Node B - Virtual Server Name: JKLOPGHF\ERT - Database
Name: NewOrleans_Capital - Table - June_2004
I would like to write a query to select data from
NewOrleans_Sales..June2004 to NewOrleans_Capital..Jun2004.
Listed below is an outline of time intervals for this
failure.
Select Sold_date, Value from NewOrleans_Capital..Jun2004
FROM NewOrleans_Sales..June2004.
Please help me with this query, do I need create a linked
server between two servers?
Thanks!
Mark
You need to create a linked server to access remote data. Use either the
OpenQuery function or the four-part name convention. Accessing a clustered
instance from another clustered instance is no different than accessing any
remote SQL server from a local SQL server.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Mark" <anonymous@.discussions.microsoft.com> wrote in message
news:0c1001c48b81$98b494f0$a401280a@.phx.gbl...
> I have a SQL Server 2000 with SP3 in a Active / Active
> Cluster. I would like to write a SQL query to receive
> database table data from the other side of the Active
> cluster.
> Node A - Virtual Server Name: HGFOPKLD\ERT - Database
> Name: NewOrleans_Sales - Table - June_2004
> Node B - Virtual Server Name: JKLOPGHF\ERT - Database
> Name: NewOrleans_Capital - Table - June_2004
> I would like to write a query to select data from
> NewOrleans_Sales..June2004 to NewOrleans_Capital..Jun2004.
> Listed below is an outline of time intervals for this
> failure.
> Select Sold_date, Value from NewOrleans_Capital..Jun2004
> FROM NewOrleans_Sales..June2004.
> Please help me with this query, do I need create a linked
> server between two servers?
> Thanks!
> Mark
>
>
>

Activating Nested Trigger with DTC

Hello,

I built a trigger that activates another trigger (Nested Trigger).

The First trigger which is located on table A inserts data into table B and in return the second trigger which is located on table B updates data in table A.

The whole process works fine when both tables are on the same server but when the tables are on different servers i get the following error:

"[Microsoft][ODBC SQL Server Driver][SQL Server]The operation could not be performed because the OLE DB Provider 'SQLOLEDB' was unable to begin a distributed transaction.
[Microsoft][ODBC SQL Server Driver][SQL Server][OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator.]"

Any ideas?Under the server properties goto connection tab and check option for 'Enforce Distributed Transactions (DTS)", make sure to uncheck the option.|||I tried it and it didn't work - I even got the same error message.

Any more ideas?|||Make sure to check whether MSDTC is running on all involved servers.|||I checked the servers and MS-DTC runs on both of them.

Could it be connected to the settings of MS-DTC? something in the settings of MS-DTC that doesn't allow a trigger to activate another trigger?|||It always helps try to refresh the services and MSDTC to get it worked.|||no, sorry, still doesn't help

I stopped and played MS-DTC on both servers + refreshed services but still no good|||I'm out of ideas now in this regard, BTW what is the SP Level?
You may refer the case of MS Support for a fix or search under KB for any fix.|||Both servers are running MS-SQL 2K, SP3

Thanks for your time,

I'll update on any solution, if will be founded..|||For information refer thru:
run SP_SERVEROPTION from QA and deliver the result.

Try to implement :

SET ANSI_DEFAULTS ON
SET ANSI_NULLS ON
SET ANSI_WARNINGS ON
SET XACT_ABORT ON
.... before the transaction begins...|||all parameters were already set as mentioned.

sp_serveroption enables changing several server parameters, which one did u mean?

Thursday, March 8, 2012

Action tracking

Hi,
We have a table that holds thousands of data in SQL server. However, the
data is suddently gone yesterday. I am just wondering if there is a way to
check when and how (who did) the data is gone. Can we track the action from
log files or somewhere?
Thanks in advance!
if you have the database at FULL recovery, download a trial version of Log
Explorer at lumigent.com. It will tell you who's who?
"Jean" <Jean@.discussions.microsoft.com> wrote in message
news:86B01DE6-8302-4C6D-9D63-8FFF7D24AB74@.microsoft.com...
> Hi,
> We have a table that holds thousands of data in SQL server. However, the
> data is suddently gone yesterday. I am just wondering if there is a way to
> check when and how (who did) the data is gone. Can we track the action
> from
> log files or somewhere?
> Thanks in advance!
|||Unfortunately, our database is Simple for recovery model. Is there any other
way to find it?
Thanks again!
"ME" wrote:

> if you have the database at FULL recovery, download a trial version of Log
> Explorer at lumigent.com. It will tell you who's who?
> "Jean" <Jean@.discussions.microsoft.com> wrote in message
> news:86B01DE6-8302-4C6D-9D63-8FFF7D24AB74@.microsoft.com...
>
>
|||:-(
why was it set at SIMPLE recovery if you need that much?
"Jean" <Jean@.discussions.microsoft.com> wrote in message
news:A7AD9D50-59E2-4B15-A03A-2399645BCC2E@.microsoft.com...[vbcol=seagreen]
> Unfortunately, our database is Simple for recovery model. Is there any
> other
> way to find it?
> Thanks again!
> "ME" wrote:

Action tracking

Hi,
We have a table that holds thousands of data in SQL server. However, the
data is suddently gone yesterday. I am just wondering if there is a way to
check when and how (who did) the data is gone. Can we track the action from
log files or somewhere?
Thanks in advance!if you have the database at FULL recovery, download a trial version of Log
Explorer at lumigent.com. It will tell you who's who?
"Jean" <Jean@.discussions.microsoft.com> wrote in message
news:86B01DE6-8302-4C6D-9D63-8FFF7D24AB74@.microsoft.com...
> Hi,
> We have a table that holds thousands of data in SQL server. However, the
> data is suddently gone yesterday. I am just wondering if there is a way to
> check when and how (who did) the data is gone. Can we track the action
> from
> log files or somewhere?
> Thanks in advance!|||Unfortunately, our database is Simple for recovery model. Is there any other
way to find it?
Thanks again!
"ME" wrote:
> if you have the database at FULL recovery, download a trial version of Log
> Explorer at lumigent.com. It will tell you who's who?
> "Jean" <Jean@.discussions.microsoft.com> wrote in message
> news:86B01DE6-8302-4C6D-9D63-8FFF7D24AB74@.microsoft.com...
> > Hi,
> >
> > We have a table that holds thousands of data in SQL server. However, the
> > data is suddently gone yesterday. I am just wondering if there is a way to
> > check when and how (who did) the data is gone. Can we track the action
> > from
> > log files or somewhere?
> >
> > Thanks in advance!
>
>|||Unless you are either running a trace, have c2 auditing,
have some trigger mechanism to sort who did what and when,
or have the utility ME sugested then no.
If I were you I would really see about tightening up
security as you either have a hacker or an inexperienced
user / developer.
Do you have back ups ?
Peter
"Happiness is having a large, loving, caring, close-knit
family in another city."
George Burns
>--Original Message--
>Hi,
>We have a table that holds thousands of data in SQL
server. However, the
>data is suddently gone yesterday. I am just wondering if
there is a way to
>check when and how (who did) the data is gone. Can we
track the action from
>log files or somewhere?
>Thanks in advance!
>.
>|||:-(
why was it set at SIMPLE recovery if you need that much?
"Jean" <Jean@.discussions.microsoft.com> wrote in message
news:A7AD9D50-59E2-4B15-A03A-2399645BCC2E@.microsoft.com...
> Unfortunately, our database is Simple for recovery model. Is there any
> other
> way to find it?
> Thanks again!
> "ME" wrote:
>> if you have the database at FULL recovery, download a trial version of
>> Log
>> Explorer at lumigent.com. It will tell you who's who?
>> "Jean" <Jean@.discussions.microsoft.com> wrote in message
>> news:86B01DE6-8302-4C6D-9D63-8FFF7D24AB74@.microsoft.com...
>> > Hi,
>> >
>> > We have a table that holds thousands of data in SQL server. However,
>> > the
>> > data is suddently gone yesterday. I am just wondering if there is a way
>> > to
>> > check when and how (who did) the data is gone. Can we track the action
>> > from
>> > log files or somewhere?
>> >
>> > Thanks in advance!
>>

Tuesday, March 6, 2012

accumulating the result of a snapshot replication filtered by date

hi all,

Im running a snapshot replication on table.

first, i gonna copy the entire table with a regional filter other than date

second i'm going to replicate a days worth of data by using both the regional filter and date filter (getdate) to capture a days wordth of data.

the publication are working fine.

my question is how am i going to accumulated the result of

the filtered snaphot replication in a single table in my db.

many thanks,

joey

Hi Joey,

You can configure your article to use 'delete' as the pre-creation command which corresponds to the 'Action if name is in use - Delete data. If article has a row filter delete only data that matches the filter' option on the article properties page. As the UI description implies, this will likely give you what you need although you need to watch out for the following:

1)

Using getdate() (and dateadd(getdate(),) most likely) to define a time range in your article filter may (or will) produce surprising result as the filter will be evaluated at different point in time as well as on different machines that don't have perfectly synchronized clocks. In the context of snapshot replication, the filter will be first evaluated at the publisher for the date range of data to be bcp'd out and then it is evaluated at a later time on the subscriber for the range of data that needs to be removed before the new data comes in. Since there is inevitably a time delay between when the snapshot is generated and when it gets delivered to the subscriber, the two date ranges will not coincide perfectly as you would hope.

Now, since time goes in only one direction, the worst that can happen to you is that the distribution agent will try to bcp in data that you already have at the subscriber (but not removed by the pre-creation command) at the lower end of your date range. This is unfortunately something that is not very well handled today as the distribution agent will likely fail with a primary key violation error while giving you very few options for recovery other than manually delete the overlapping data. However, if there are well-defined date gaps (say, off business hours) in your data, you can make the low end of your date range coincide with the gap. Note thta this can be tricky to maintain as the snapshot agent schedule and the date gap may change in the future.

From my perspective, the only robust way to achieve what you want is to keep track of the latest timestamp of the last snapshot iteration and use that to define an explicit date range you need in your filter before starting the next snapshot iteration. Here is a rough outline on how you may achieve this:

i. Call getdate() to get the upper bound of new date range

ii. Use the upper bound of the previous snapshot iteration and the new upper bound to define a new filter clause with the date values hardcoded and pass that into sp_articleview to generate a new synchronization view that the snapshot agent will use to bcp out data.

iii. Wait until the new snapshot is distributed to the subscriber and then update latest timestamp of the last snapshot at the publisher.

The last step is actually important because you may end up with a gap at the subscriber if your lower bound is defined to be too far ahead of what the subscriber has actually received. As such, it may be worthwhile to generalize the procedure above by keeping track of the upper bounds of the last couple of snapshot iterations and choose a more conservative lower bound to be further back in time (the pre-creation command should take care of removing any overlapping data).

At this point, you are probably wondering why we make what is arguably a common scenario so difficult, and I would say that you are absolutely right in thinking so. But given that things are what they are today, I can only encourage you to log a DCR at http://lab.msdn.microsoft.com/productfeedback/Default.aspx so we can allocate resources to make data archival scenarios simpler using snapshot replication.

2) (Well, I am not quite done yet :)

Since the subscriber data is most likely not empty when the distribution agent bcp data in, you will most likely not get the performance benefits of minimally-logged bulk-load. Because of this, you may need to be careful that you are not moving too much data in each snapshot iteration.

Hope that helps.

-Raymond

Accumulated value in table detailrow

I have a dataset with a GROUP BY connected to my table.
In the detailrow I want to add a accumulated value calculated from another
field.
Like this:
MonthX ValueY Acc. value
--
Month 1 10 10
Month 2 20 30
Month 3 30 60
Month 4 40 100
Can I do it by referencing the textboxes in the table, or can i change my
transact-SQL in any way?
(SELECT MonthX,SUM(SomeValue)/SUM(AnotherValue) AS ValueY FROM MyTable GROUP
BY MonthX ORDER BY MonthX)
Please help!Take a look at the reporting services RunningValue function.
"Olof" <Olof@.discussions.microsoft.com> wrote in message
news:4FF60820-A413-4CDB-BAB3-991DBDB8759A@.microsoft.com...
>I have a dataset with a GROUP BY connected to my table.
> In the detailrow I want to add a accumulated value calculated from another
> field.
> Like this:
> MonthX ValueY Acc. value
> --
> Month 1 10 10
> Month 2 20 30
> Month 3 30 60
> Month 4 40 100
> Can I do it by referencing the textboxes in the table, or can i change my
> transact-SQL in any way?
> (SELECT MonthX,SUM(SomeValue)/SUM(AnotherValue) AS ValueY FROM MyTable
> GROUP
> BY MonthX ORDER BY MonthX)
> Please help!|||Thank you very much Stephen, that function was exactly what I needed!!
Greetings
Olof
"Stephen Farmer" wrote:
> Take a look at the reporting services RunningValue function.
>
> "Olof" <Olof@.discussions.microsoft.com> wrote in message
> news:4FF60820-A413-4CDB-BAB3-991DBDB8759A@.microsoft.com...
> >I have a dataset with a GROUP BY connected to my table.
> > In the detailrow I want to add a accumulated value calculated from another
> > field.
> > Like this:
> > MonthX ValueY Acc. value
> > --
> > Month 1 10 10
> > Month 2 20 30
> > Month 3 30 60
> > Month 4 40 100
> >
> > Can I do it by referencing the textboxes in the table, or can i change my
> > transact-SQL in any way?
> > (SELECT MonthX,SUM(SomeValue)/SUM(AnotherValue) AS ValueY FROM MyTable
> > GROUP
> > BY MonthX ORDER BY MonthX)
> >
> > Please help!
>
>

Accumulate values in an aditional column

Hi I have a table like this:

CLIENT Value

a 12
b 11
c 8
d 5
e 4

I want to accumulate this values in an aditional column


CLIENT Value ACUM
a 12 12
b 11 12 + 11 = 23
c 8 23 + 8 = 31
d 5 31 + 5 = 36
e 4 36 + 4 = 40

Thks for your help

Rgds

Harry

CREATE TABLE dbo.RunningTotal

(

Entry int

,RunningTotal int

)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(100,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(200,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(300,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(400,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(500,NULL)

UPDATE dbo.RunningTotal

SET RunningTotal = RT2.RunningTotal

FROM dbo.RunningTotal RT1

INNER JOIN

(

SELECT Entry

,(SELECT SUM(Entry) FROM dbo.RunningTotal WHERE Entry <= rt.Entry) As RunningTotal

FROM dbo.RunningTotal rt

) RT2

ON RT1.Entry = RT2.Entry

SELECT * FROM dbo.RunningTotal

Resultset:

Entry RunningTotal

100 100

200 300

300 600

400 1000

500 1500

|||

What would I have to do if i want to decrement this values?

CLIENT Value ACUM
a 12 12
b 11 11-12 = -1
c 8 8-11 = -3
d 10 10-8 = 2
e 4 4 -10 = -6

Hope to recieve some news soon

Rgds & a lot of thks

Harry

|||

There are endless variations depending on table structure, data and what you want to do with the data.

Here is one other example:

CREATE TABLE dbo.Balance

(

ID int

,Entry int

,RunningTotal int

)

TRUNCATE TABLE dbo.Balance

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(1,500,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(2,-400,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(3,-300,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(4,-200,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(5,-100,NULL)

UPDATE dbo.Balance

SET RunningTotal = RT2.RunningTotal

FROM dbo.Balance RT1

INNER JOIN

(

SELECT Entry

,(SELECT -SUM(-Entry) FROM dbo.Balance WHERE ID <= rt.ID ) As RunningTotal

FROM dbo.Balance rt

) RT2

ON RT1.Entry = RT2.Entry

SELECT * FROM dbo.Balance

IDEntryRunningTotal

1500500

2-400100

3-300-200

4-200-400

5-100-500

|||

I try this , but the values only are growing

the table with this input values must be

ID Entry RunningTotal

1 500 500

2 -400 -400 - 500 = -900

3 -300 -300-(-900) = 600

4 -200 -200-(-300) = 100

5 -100 -100 - 100 = -200

How coud I do this?

|||

That is a good method and works perfectly for relatively small number of records

Unfortunatly for a large number it is too slow ,,, :(:(:( do you have another faster method ?

I'm a little desparate

Thanks

|||Yes. do it in your front end application or reporting tool.

Accumulate values in an aditional column

Hi I have a table like this:

CLIENT Value

a 12
b 11
c 8
d 5
e 4

I want to accumulate this values in an aditional column


CLIENT Value ACUM
a 12 12
b 11 12 + 11 = 23
c 8 23 + 8 = 31
d 5 31 + 5 = 36
e 4 36 + 4 = 40

Thks for your help

Rgds

Harry

CREATE TABLE dbo.RunningTotal

(

Entry int

,RunningTotal int

)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(100,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(200,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(300,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(400,NULL)

INSERT INTO dbo.RunningTotal (Entry,RunningTotal)VALUES(500,NULL)

UPDATE dbo.RunningTotal

SET RunningTotal = RT2.RunningTotal

FROM dbo.RunningTotal RT1

INNER JOIN

(

SELECT Entry

,(SELECT SUM(Entry) FROM dbo.RunningTotal WHERE Entry <= rt.Entry) As RunningTotal

FROM dbo.RunningTotal rt

) RT2

ON RT1.Entry = RT2.Entry

SELECT * FROM dbo.RunningTotal

Resultset:

Entry RunningTotal

100 100

200 300

300 600

400 1000

500 1500

|||

What would I have to do if i want to decrement this values?

CLIENT Value ACUM
a 12 12
b 11 11-12 = -1
c 8 8-11 = -3
d 10 10-8 = 2
e 4 4 -10 = -6

Hope to recieve some news soon

Rgds & a lot of thks

Harry

|||

There are endless variations depending on table structure, data and what you want to do with the data.

Here is one other example:

CREATE TABLE dbo.Balance

(

ID int

,Entry int

,RunningTotal int

)

TRUNCATE TABLE dbo.Balance

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(1,500,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(2,-400,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(3,-300,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(4,-200,NULL)

INSERT INTO dbo.Balance (ID,Entry,RunningTotal)VALUES(5,-100,NULL)

UPDATE dbo.Balance

SET RunningTotal = RT2.RunningTotal

FROM dbo.Balance RT1

INNER JOIN

(

SELECT Entry

,(SELECT -SUM(-Entry) FROM dbo.Balance WHERE ID <= rt.ID ) As RunningTotal

FROM dbo.Balance rt

) RT2

ON RT1.Entry = RT2.Entry

SELECT * FROM dbo.Balance

IDEntryRunningTotal

1500500

2-400100

3-300-200

4-200-400

5-100-500

|||

I try this , but the values only are growing

the table with this input values must be

ID Entry RunningTotal

1 500 500

2 -400 -400 - 500 = -900

3 -300 -300-(-900) = 600

4 -200 -200-(-300) = 100

5 -100 -100 - 100 = -200

How coud I do this?

|||

That is a good method and works perfectly for relatively small number of records

Unfortunatly for a large number it is too slow ,,, :(:(:( do you have another faster method ?

I'm a little desparate

Thanks

|||Yes. do it in your front end application or reporting tool.

Saturday, February 25, 2012

Accidently delete records

Hello All,
I'm need help!
I have accidently deleted all record from a table. I don't have a backup at the time I deleted. Could you all tell me if there's a way to recover those records?
Thanks.
David
You may be able to use your transaction logs to do a point in time restore,
I'm not sure, but there is hope.
"David" <David@.discussions.microsoft.com> wrote in message
news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup
at the time I deleted. Could you all tell me if there's a way to recover
those records?
> Thanks.
> David
|||Lyle,
How do I do that? Could you please share some hint?
"Lyle Spencer" wrote:

> You may be able to use your transaction logs to do a point in time restore,
> I'm not sure, but there is hope.
> "David" <David@.discussions.microsoft.com> wrote in message
> news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> at the time I deleted. Could you all tell me if there's a way to recover
> those records?
>
>
|||YOu will need to take your full backups and apply the
trans logs up to the point in time you deleted the table
and you can then retrieve the records.
Here's an example from BOL
-- Restore the database backup.
RESTORE DATABASE MyNwind
FROM MyNwind_1, MyNwind_2
WITH NORECOVERY
GO
RESTORE LOG MyNwind
FROM MyNwind_log1
WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
GO
RESTORE LOG MyNwind
FROM MyNwind_log2
WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
[vbcol=seagreen]
>--Original Message--
>Lyle,
>How do I do that? Could you please share some hint?
>
>"Lyle Spencer" wrote:
point in time restore,[vbcol=seagreen]
message[vbcol=seagreen]
69D4AA671891@.microsoft.com...[vbcol=seagreen]
don't have a backup[vbcol=seagreen]
there's a way to recover
>.
>
|||Hmmm... My problem is that I've never done a backup for that database.
"anonymous@.discussions.microsoft.com" wrote:

> YOu will need to take your full backups and apply the
> trans logs up to the point in time you deleted the table
> and you can then retrieve the records.
> Here's an example from BOL
> -- Restore the database backup.
> RESTORE DATABASE MyNwind
> FROM MyNwind_1, MyNwind_2
> WITH NORECOVERY
> GO
> RESTORE LOG MyNwind
> FROM MyNwind_log1
> WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
> GO
> RESTORE LOG MyNwind
> FROM MyNwind_log2
> WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
> point in time restore,
> message
> 69D4AA671891@.microsoft.com...
> don't have a backup
> there's a way to recover
>
|||Hi,
This will work only if you have the database in FULL recovery model, must
have a FULL database Backup ,
all the subsequent trasnaction log backup files after the full backup.
I feel that in your case you cant revert back with out a backup.
Note:-
Based on the criticality of data please choose a recovery model and define
necessory backup procedures
for your SQL Server databases.
Thanks
Hari
MCDBA
"David" <David@.discussions.microsoft.com> wrote in message
news:EEEAE0E7-BA74-40BF-BC32-840649B457DA@.microsoft.com...[vbcol=seagreen]
> Hmmm... My problem is that I've never done a backup for that database.
>
> "anonymous@.discussions.microsoft.com" wrote:
|||> Hmmm... My problem is that I've never done a backup for that database.
Then you must not consider the data very important!
http://www.aspfaq.com/2449
|||I've never use Lumigent, but they claim to go through the internal free list
(as well as syslogs) to recover what might never be recoverable otherwise.
"David" <David@.discussions.microsoft.com> wrote in message
news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup
at the time I deleted. Could you all tell me if there's a way to recover
those records?
> Thanks.
> David
|||Hi David,
Saw your reply and try download the Log P.I software and this is realyl good.
The web site is www.logpi.com You can restore the deleted transactions, but make sure you follow the steps they have mentioned.
Regards
RK.
"David" wrote:

> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup at the time I deleted. Could you all tell me if there's a way to recover those records?
> Thanks.
> David

Accidently delete records

Hello All,
I'm need help!
I have accidently deleted all record from a table. I don't have a backup at
the time I deleted. Could you all tell me if there's a way to recover those
records?
Thanks.
DavidYou may be able to use your transaction logs to do a point in time restore,
I'm not sure, but there is hope.
"David" <David@.discussions.microsoft.com> wrote in message
news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup
at the time I deleted. Could you all tell me if there's a way to recover
those records?
> Thanks.
> David|||Lyle,
How do I do that? Could you please share some hint?
"Lyle Spencer" wrote:

> You may be able to use your transaction logs to do a point in time restore
,
> I'm not sure, but there is hope.
> "David" <David@.discussions.microsoft.com> wrote in message
> news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> at the time I deleted. Could you all tell me if there's a way to recover
> those records?
>
>|||YOu will need to take your full backups and apply the
trans logs up to the point in time you deleted the table
and you can then retrieve the records.
Here's an example from BOL
-- Restore the database backup.
RESTORE DATABASE MyNwind
FROM MyNwind_1, MyNwind_2
WITH NORECOVERY
GO
RESTORE LOG MyNwind
FROM MyNwind_log1
WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
GO
RESTORE LOG MyNwind
FROM MyNwind_log2
WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'

>--Original Message--
>Lyle,
>How do I do that? Could you please share some hint?
>
>"Lyle Spencer" wrote:
>
point in time restore,[vbcol=seagreen]
message[vbcol=seagreen]
69D4AA671891@.microsoft.com...[vbcol=seagreen]
don't have a backup[vbcol=seagreen]
there's a way to recover[vbcol=seagreen]
>.
>|||Hmmm... My problem is that I've never done a backup for that database.
"anonymous@.discussions.microsoft.com" wrote:

> YOu will need to take your full backups and apply the
> trans logs up to the point in time you deleted the table
> and you can then retrieve the records.
> Here's an example from BOL
> -- Restore the database backup.
> RESTORE DATABASE MyNwind
> FROM MyNwind_1, MyNwind_2
> WITH NORECOVERY
> GO
> RESTORE LOG MyNwind
> FROM MyNwind_log1
> WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
> GO
> RESTORE LOG MyNwind
> FROM MyNwind_log2
> WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
>
> point in time restore,
> message
> 69D4AA671891@.microsoft.com...
> don't have a backup
> there's a way to recover
>|||Hi,
This will work only if you have the database in FULL recovery model, must
have a FULL database Backup ,
all the subsequent trasnaction log backup files after the full backup.
I feel that in your case you cant revert back with out a backup.
Note:-
Based on the criticality of data please choose a recovery model and define
necessory backup procedures
for your SQL Server databases.
Thanks
Hari
MCDBA
"David" <David@.discussions.microsoft.com> wrote in message
news:EEEAE0E7-BA74-40BF-BC32-840649B457DA@.microsoft.com...[vbcol=seagreen]
> Hmmm... My problem is that I've never done a backup for that database.
>
> "anonymous@.discussions.microsoft.com" wrote:
>|||> Hmmm... My problem is that I've never done a backup for that database.
Then you must not consider the data very important!
http://www.aspfaq.com/2449|||I've never use Lumigent, but they claim to go through the internal free list
(as well as syslogs) to recover what might never be recoverable otherwise.
"David" <David@.discussions.microsoft.com> wrote in message
news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup
at the time I deleted. Could you all tell me if there's a way to recover
those records?
> Thanks.
> David|||Hi David,
Saw your reply and try download the Log P.I software and this is realyl good
.
The web site is www.logpi.com You can restore the deleted transactions, but
make sure you follow the steps they have mentioned.
Regards
RK.
"David" wrote:

> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup a
t the time I deleted. Could you all tell me if there's a way to recover thos
e records?
> Thanks.
> David

Accidently delete records

Hello All,
I'm need help!
I have accidently deleted all record from a table. I don't have a backup at the time I deleted. Could you all tell me if there's a way to recover those records?
Thanks.
DavidYou may be able to use your transaction logs to do a point in time restore,
I'm not sure, but there is hope.
"David" <David@.discussions.microsoft.com> wrote in message
news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup
at the time I deleted. Could you all tell me if there's a way to recover
those records?
> Thanks.
> David|||Lyle,
How do I do that? Could you please share some hint?
"Lyle Spencer" wrote:
> You may be able to use your transaction logs to do a point in time restore,
> I'm not sure, but there is hope.
> "David" <David@.discussions.microsoft.com> wrote in message
> news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> > Hello All,
> >
> > I'm need help!
> > I have accidently deleted all record from a table. I don't have a backup
> at the time I deleted. Could you all tell me if there's a way to recover
> those records?
> >
> > Thanks.
> > David
>
>|||YOu will need to take your full backups and apply the
trans logs up to the point in time you deleted the table
and you can then retrieve the records.
Here's an example from BOL
-- Restore the database backup.
RESTORE DATABASE MyNwind
FROM MyNwind_1, MyNwind_2
WITH NORECOVERY
GO
RESTORE LOG MyNwind
FROM MyNwind_log1
WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
GO
RESTORE LOG MyNwind
FROM MyNwind_log2
WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
>--Original Message--
>Lyle,
>How do I do that? Could you please share some hint?
>
>"Lyle Spencer" wrote:
>> You may be able to use your transaction logs to do a
point in time restore,
>> I'm not sure, but there is hope.
>> "David" <David@.discussions.microsoft.com> wrote in
message
>> news:37E4E743-B412-4BF9-BFE2-
69D4AA671891@.microsoft.com...
>> > Hello All,
>> >
>> > I'm need help!
>> > I have accidently deleted all record from a table. I
don't have a backup
>> at the time I deleted. Could you all tell me if
there's a way to recover
>> those records?
>> >
>> > Thanks.
>> > David
>>
>.
>|||Hmmm... My problem is that I've never done a backup for that database.
"anonymous@.discussions.microsoft.com" wrote:
> YOu will need to take your full backups and apply the
> trans logs up to the point in time you deleted the table
> and you can then retrieve the records.
> Here's an example from BOL
> -- Restore the database backup.
> RESTORE DATABASE MyNwind
> FROM MyNwind_1, MyNwind_2
> WITH NORECOVERY
> GO
> RESTORE LOG MyNwind
> FROM MyNwind_log1
> WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
> GO
> RESTORE LOG MyNwind
> FROM MyNwind_log2
> WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
> >--Original Message--
> >Lyle,
> >
> >How do I do that? Could you please share some hint?
> >
> >
> >"Lyle Spencer" wrote:
> >
> >> You may be able to use your transaction logs to do a
> point in time restore,
> >> I'm not sure, but there is hope.
> >>
> >> "David" <David@.discussions.microsoft.com> wrote in
> message
> >> news:37E4E743-B412-4BF9-BFE2-
> 69D4AA671891@.microsoft.com...
> >> > Hello All,
> >> >
> >> > I'm need help!
> >> > I have accidently deleted all record from a table. I
> don't have a backup
> >> at the time I deleted. Could you all tell me if
> there's a way to recover
> >> those records?
> >> >
> >> > Thanks.
> >> > David
> >>
> >>
> >>
> >.
> >
>|||Hi,
This will work only if you have the database in FULL recovery model, must
have a FULL database Backup ,
all the subsequent trasnaction log backup files after the full backup.
I feel that in your case you cant revert back with out a backup.
Note:-
Based on the criticality of data please choose a recovery model and define
necessory backup procedures
for your SQL Server databases.
Thanks
Hari
MCDBA
"David" <David@.discussions.microsoft.com> wrote in message
news:EEEAE0E7-BA74-40BF-BC32-840649B457DA@.microsoft.com...
> Hmmm... My problem is that I've never done a backup for that database.
>
> "anonymous@.discussions.microsoft.com" wrote:
> > YOu will need to take your full backups and apply the
> > trans logs up to the point in time you deleted the table
> > and you can then retrieve the records.
> >
> > Here's an example from BOL
> > -- Restore the database backup.
> > RESTORE DATABASE MyNwind
> > FROM MyNwind_1, MyNwind_2
> > WITH NORECOVERY
> > GO
> > RESTORE LOG MyNwind
> > FROM MyNwind_log1
> > WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
> > GO
> > RESTORE LOG MyNwind
> > FROM MyNwind_log2
> > WITH RECOVERY, STOPAT = 'Jul 1, 1998 10:00 AM'
> >
> > >--Original Message--
> > >Lyle,
> > >
> > >How do I do that? Could you please share some hint?
> > >
> > >
> > >"Lyle Spencer" wrote:
> > >
> > >> You may be able to use your transaction logs to do a
> > point in time restore,
> > >> I'm not sure, but there is hope.
> > >>
> > >> "David" <David@.discussions.microsoft.com> wrote in
> > message
> > >> news:37E4E743-B412-4BF9-BFE2-
> > 69D4AA671891@.microsoft.com...
> > >> > Hello All,
> > >> >
> > >> > I'm need help!
> > >> > I have accidently deleted all record from a table. I
> > don't have a backup
> > >> at the time I deleted. Could you all tell me if
> > there's a way to recover
> > >> those records?
> > >> >
> > >> > Thanks.
> > >> > David
> > >>
> > >>
> > >>
> > >.
> > >
> >|||> Hmmm... My problem is that I've never done a backup for that database.
Then you must not consider the data very important!
http://www.aspfaq.com/2449|||I've never use Lumigent, but they claim to go through the internal free list
(as well as syslogs) to recover what might never be recoverable otherwise.
"David" <David@.discussions.microsoft.com> wrote in message
news:37E4E743-B412-4BF9-BFE2-69D4AA671891@.microsoft.com...
> Hello All,
> I'm need help!
> I have accidently deleted all record from a table. I don't have a backup
at the time I deleted. Could you all tell me if there's a way to recover
those records?
> Thanks.
> David

accidentally deleted a table in my local SQL Server how can I get back the table

Hi,

I accidentally deleted a table in my local server. How can I get back the table? I did not do it as a transaction!

Thanks in AdvanceYou need to restore back from your backup if available. There may be third party softwares that allow you to do such operations ...

Accidentailly changed too many records -

Hi
This might be a trivial question, bit I'm not that experienced in updating
from a table in another database.
We changed a number of records in a table, and unfortunately we did a
mistake so too many was changed.
I've now restored a backup from last night and wants to update the database
with the data from the table in the backup.
The backup has been restored as a new database on the same server as the
"live" database.
I'm trying to do it with an UPDATE statement where I update the tesxt in one
field with the text from the backup, where the record Id is the same in both
tables. My problem is then, that apparently I can't fiugre out to define
that I want to use data from a different database.
The code I'm trying to run is :
UPDATE findimension
SET beskrivelse = Test629.dbo.findimension.beskrivelse
FROM Test629.dbo.findimension.beskrivelse, beskrivelse
WHERE finfimension.findimensionID =
Test629.dbo.findimension.findimensionID
I'm working on the database I want to update, and I want to update from the
database name 'Test629'. When I run the above statement, it tells me that it
can't find server Test629 in sysservers - which is fair enough, since it
isn't a server but a database...:-).
How do I define this in the right way, so it looks at the "Beskrivelse"
column in the findimension table in the Test629 database.
Hope some of you can help?
Regards
SteenYou referenced the table as Test629.dbo.findimension.beskrivelse - since
there are four parts to the name, the engine assumes that Test629 is a
server name. The last part of the name appears to be a column name - remove
it.
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:%23vJ8WZjdEHA.4004@.TK2MSFTNGP10.phx.gbl...
> Hi
> This might be a trivial question, bit I'm not that experienced in updating
> from a table in another database.
> We changed a number of records in a table, and unfortunately we did a
> mistake so too many was changed.
> I've now restored a backup from last night and wants to update the
database
> with the data from the table in the backup.
> The backup has been restored as a new database on the same server as the
> "live" database.
> I'm trying to do it with an UPDATE statement where I update the tesxt in
one
> field with the text from the backup, where the record Id is the same in
both
> tables. My problem is then, that apparently I can't fiugre out to define
> that I want to use data from a different database.
> The code I'm trying to run is :
> UPDATE findimension
> SET beskrivelse = Test629.dbo.findimension.beskrivelse
> FROM Test629.dbo.findimension.beskrivelse, beskrivelse
> WHERE finfimension.findimensionID =
> Test629.dbo.findimension.findimensionID
> I'm working on the database I want to update, and I want to update from
the
> database name 'Test629'. When I run the above statement, it tells me that
it
> can't find server Test629 in sysservers - which is fair enough, since it
> isn't a server but a database...:-).
> How do I define this in the right way, so it looks at the "Beskrivelse"
> column in the findimension table in the Test629 database.
> Hope some of you can help?
> Regards
> Steen
>|||Thanks...that was it...
Regards
Steen
Scott Morris wrote:[vbcol=seagreen]
> You referenced the table as Test629.dbo.findimension.beskrivelse -
> since there are four parts to the name, the engine assumes that
> Test629 is a server name. The last part of the name appears to be a
> column name - remove it.
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:%23vJ8WZjdEHA.4004@.TK2MSFTNGP10.phx.gbl...