How To Skip Applying The Current Remaining Logs?
Jul 17, 2006
Hi,
My replication application need to be able to skip the from-last-stop remaining logs (that means to skip the logs generated from the last stop time of my replication application), how can i realize it? thanks.
View 6 Replies
ADVERTISEMENT
Jun 21, 2001
Can anyone direct me to a code that would automatically apply transaction logs to a DB in the standby server? We have a process that dumps the transaction log backup from the primary server into the backup server every hour on the hour, but I need to apply that transaction log as soon as it is in the standby server.
I am sure someone will ask, why not do transactional replication or log shipping? My answer to that is I have yet to learn how to setup replication between servers. I need to get our backup server up and running in the next few days.
Thanks in advance for your help.
Helen
View 1 Replies
View Related
Nov 28, 2005
Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server Logs/current file. Is there a way I can shorten that file so it won't take so long to view the current file?
Thanks in advance. :eek:
View 2 Replies
View Related
Apr 15, 2008
Hi all
Just now a BCK job failed I have only one way to find out the cause of failure fromLOG,but log file is not opening
what is the cause may be?
View 5 Replies
View Related
Apr 21, 2008
HI,
I want to know if there's an easier way to do a calculation on the remaining total of the months. For example: month 09 would be (total *3 ) because 9+3 = 12 and there are 12 months in a year.
month total
01 2217.3700
02 2187.6600
03 2243.6500
04 2216.1000
05 2374.4200
06 2296.2200
07 2266.6000
08 2164.2600
09 2085.2400
View 4 Replies
View Related
Oct 10, 2013
I have two SQL tables
Coupon and Coupon CouponStore
In Coupon there is a column of CouponID and in CouponStore the same column name.
Also in CouponStore there is a column called StoreID that has the value of each store 1, 2, 3 and 4.
How would I write a script to map any CouponID in the Coupon table to each Store Value that are not already mapped to a StoreID?
View 6 Replies
View Related
Aug 6, 2015
OS: Windows 2012 Enterprise
SQL Server: 2012 Enterprise
I was wondering if there is any way all SQL Server error log entries could be automatically written to Windows Event Log.
View 3 Replies
View Related
Aug 22, 2003
recently i noticed that my trans Log size is not increasing(it is constant) , but the databse size is increasing at high speed.
why is it so? earlier the reverse used to happen i.e databse size increased only after a certain period. and log size increased at const. rate.
View 5 Replies
View Related
Jan 21, 2008
I have already created Tran. Replication for one database and it is working fine. But i have added 3 tables to the database and i want to do replication for that tables with same publications . I mean i can go to Publishers Properties and add articles but the problem is:
1)When i run the snapshot agent,it creates the snapshot whole database which is bigger in size .
2)Is there a way i can run snapshot agent for remaining articles in same publication.
3)How to do it step by step
Any help will be appreciated
Thanks
Experts
View 6 Replies
View Related
Feb 22, 2008
Hello,
I need to pull records from single table such that I get a subset defined like this:
(
acctcode = 'xh364'
and
product = 'T&E'
)
And return all of the rest of the records:
(
acctcode = '%'
and
product = '%'
)
Can I do this within a WHERE clause, or will this require CASE / ELSE? There will be other specific acctcode/product rules that will be added later. I could do this with a UNION, but I need to avoid that if possible.
Thank you for your help!
cdun2
View 6 Replies
View Related
Dec 19, 2003
Hi
I have seen the threads already in here about connections and SQL Server but I too am having a connection pool problem.
I am explicitly making a connection, creating a command object, executing a datareader then closing the command and then disposing the connection. The connection just prior to the dispose is definately closed.
However when I do an sp_who in SQL Server the connection is still listed. I have a connection timeout of 30 seconds, so I am considering reducing this to 5 seconds but dont wish to. So therefore when a process is called repeatedly instead of using an existing connection in the pool, it thinks that this connection is still active and therefore creates a new connection. Because all of this is in an ascx, I cant code for one connection to stay open for all 30 instances of the control.
This is a problem because I am creating controls at run time and using page.databind and at that point, I exceed the connection pool and therefore the site crashes out to the "SQL Server Timeout" error.
Anyone else seen this?
View 1 Replies
View Related
Feb 12, 2007
Hi,
In my case I have to log the errors raised by any task in a package to either windows event log, text file or SQL server. Also I need to send an email notifications to a group of people telling them about the error.
Now can I use SSIS package logging for logging the errors into the required destinations. I mean right clicking on the package and selecting Logging, then adding the required log providers and enabling the events for logging into those. I think I have to upfront select the log providers to log the error, I will not have the liberty to log the error to the destination, the name of which is passed as a variable to the package. This is okay with me though.
Now what will a custom log provider help me to do in this case. Also can I somehow configure my package to call the send mail task everytime an error is raised.
Also, one more option can be developing a package that only does the error handling. It will take in the paramters or the error codes and descriptions, the destination to write to and a flag to send mail or not for that particular type of error.
What do you think? Kindly advise.
Thanks in advance for your help and time.
Regards,
$wapnil
View 3 Replies
View Related
Aug 4, 2015
I have a table 'library' with two columns
user_name, access_time
every user is having more than 500 entries, i want to keep only top 50 records for every user and delete the remaining records.
View 9 Replies
View Related
Aug 28, 2001
When looking at SQL Server error logs, I noticed that the current error
log had grown to 1MB whereas most of the files are only a few KB.
QUESTION 1: Can I set the max size for an error log file? If so, how?
QUESTION 2: If not, is there a workaround?
Thanks
View 1 Replies
View Related
Jan 14, 2008
Hello everyone,
I have a package that extracts data from a Flat File. If any errors or truncation occur during the extraction of the input data, the package should fail. All fields that have erroneous values should be reported in the log file.
My Solution:
- I have created a Data Flow Task that contains a Flat File Source Adapter and a dummy destination.
- I have left the default "Error Output" configuration of the Flat File Source adapter, namely if a truncation or an error occur for a certain column, then the reaction is "Fail Component".
Problem:
This configuration gives me only the first erroneous column in the row being processed.
Question:
Is it possible to make the Flat File Source adapter continue parsing the current row before it fails? This way, I would be able to get all the erroneous columns in the row in one shot.
Thanks in advance...
Samar
View 6 Replies
View Related
Jun 8, 2008
I've this query
SELECT
t1.ID, t1.Date, t1.Time,
t1.VALUE
FROM RESULT WHERE t1.Date>=CONVERT(VARCHAR(10),DATEADD(d,-7,GETDATE()),101) AND
t1.Date<CONVERT(VARCHAR(10), GETDATE(), 101)
Let's say, current date is 8 AUG 2005 and current time is 2045
So, i will get
ID | Date (this is datetime) | Time (this is integer) | Value
--------------------------------------------------
204 | 8/1/2005| 2359 | 90
205 | 8/1/2005| 2250 | 99
206 | 8/1/2005| 1950 | 88
...
...
207 | 8/7/2005| 1845 | 77
208 | 8/7/2005| 2255 | 77
209 | 8/7/2005| 2140 | 77
Can someone can show me to filter data between
t1.Date>=CONVERT(VARCHAR(10),DATEADD(d,-7,GETDATE()),101) AND TIME>=CurrentTime
t1.Date<CONVERT(VARCHAR(10), GETDATE(), 101) AND TIME<=CurrentTime
If current date is 8 AUG 2005 and current time is 2045, so the result shown as follow
ID | Date (this is datetime) | Time (this is integer) | Value
--------------------------------------------------
204 | 8/1/2005| 2359 | 90
205 | 8/1/2005| 2250 | 99
...
...
207 | 8/7/2005| 1845 | 77
I only have this query,
SELECT
t1.ID, t1.Date, t1.Time,
t1.VALUE
FROM RESULT WHERE t1.Date>=CONVERT(VARCHAR(10),DATEADD(d,-7,GETDATE()),101) AND
t1.Date<CONVERT(VARCHAR(10), GETDATE(), 101)
lack of idea to put the TIME condition.
Plz help me..
View 14 Replies
View Related
Mar 13, 2001
Does any one know, how to skip the first and last row of a text file while importing using DTS.
ThankX in advance.
View 1 Replies
View Related
Dec 3, 2014
I have a table with about half a million records, each representing a patient in my county.
Each record has a field (RRank) which basically sorts the patients as to how "unwell" they are according to a previously-applied algorithm. The most unwell patient has an RRank of 1, the next-most unwell has RRank=2 etc.
I have just deleted several hundred records (which relate to patients now deceased) from the table, thereby leaving gaps in the RRank sequence. I want to renumber the remaining recs to get rid of the gaps.
I can see what I want to accomplish by using ROW_NUMBER, thus:
SELECT ROW_NUMBER() Over (ORDER BY RRank) as RecNumber, RRank
FROM RPL
ORDER BY RRank
I see the numbers in the RecNumber column falling behind the RRank as I scan down the results
My question is: How to convert this into an UPDATE statement? I had hoped that I could do something like:
UPDATE RISC_PatientList_TEMP
SET RRank = ROW_NUMBER() Over (ORDER BY RRank);
but the system informs that window functions will only work on SELECT (which UPDATE isn't) or ORDER BY (which I can't legally add).
View 5 Replies
View Related
Feb 20, 2007
Hi,another problem I have is that have compounded fields in my sql table.Exampleproduct@customerI need a simple function to return "customer", so it should return the valueafter "@", unfortunate "@" will sometimes be character number 6, sometimescharacter number 7 etc.regardsJorgen
View 1 Replies
View Related
Oct 10, 2007
Hi All,
I my requirement I need to read all the files from folder (one by one) and insert data from those files into the database table . I am facing one issue here . If suppose while executing if any of the file fails its not executing the other files. Package stops execution.
I cannot use Redirect rows option beacuse as per requirment if file has some Data problem , I am suppose to ignore the file instead of Data Rows.
Is there is any property in for each file task .....kindly suggest
Regards
Shagun
View 1 Replies
View Related
Oct 21, 2004
Hello:
I have one table and it contains a column named ID Number, and a column named Date. I have a Do While statement that runs a SQL select statement a few times based on the number of records with the same ID Number. During the Do While statement the information is copied into another table and deleted from the old table. After I look at the results, I see that at the second Do While loop, the data was not selected and the Select statement did not run... so the old variable value from varValue is used again... Any reasons on why?
Here is a code snippet of what is going on:
Do While varCount < varRecordCount
conSqlConnect.Open()
cmdSelect = New SqlCommand ("Select * From temp_records_1 where [id number]=@idnumber and date<@date", conSqlConnect)
cmdSelect.Parameters.Add( "@accountnumber", "10000" )
cmdSelect.Parameters.Add( "@date", dtnow )
dtrdatareader = cmdSelect.ExecuteReader()
While dtrdatareader.Read()
If IsDbNull(dtrdatareader("value")) = false Then
varValue = dtrdatareader("value")
End If
End While
dtrdatareader.Close()
conSqlConnect.Close()
'#####The information above is copied to another table here
'#####The record where the information was received is deleted.
varCount = varCount + 1
LoopAny ideas?
View 2 Replies
View Related
Mar 13, 2000
Hello somebody,
I submitted an update query on a table of 80 million rows, in the weekend. When I returned on Monday, the transaction was still running. I thought some thing wrong happened and cancelled the transaction. It was taking long time to rollback the transaction. I recycled the SQL Server assuming it will do faster recovery. Now I realised that anyway it is going to take lot of time. And SQL server is not going to be up till the database is recoverd completely.
Now can any body suggest me any thing to faster this process or skip this process. I dont know how long it is going to take rollback the transaction which ran for more than 70 hours.
Thanx in advance.
View 1 Replies
View Related
Apr 19, 2004
I was attempting to use BCP today via xp_cmdshell. I have never done anything with BCP before, so it was very enlightening. However, I ran across a problem that maybe someone could help explain to me a little more.
I am using the "queryout" option, and when I run it, the error I get is that you "can't skip fields except for on inserts" or something like that.
The reason I was trying to use bcp is the ability to dynamically generate a filename, i.e. filename = 04182004 (the date). Because in the file name argument, I can use a variable. Make sense?
Since I apparently can't ignore fields, I am thinking of taking all of the information I need daily out, and into a seperate table, then I can use the xp_cmdshell to run a bcp that creates a file with the date as a filename, and I won't be ignoring any fields because I have just put the information I need in the new table. Am I making sense? Does this sound like an appropriate thing to do?
View 3 Replies
View Related
Oct 25, 2007
Hello
I am tryung to execute a Store Proc using Execute SQL Task.
I am very aware that if there is any errors occur I have handled it sufficiently.
All I want to do is, when ever there are any errors in teh Store Proc then this Execute SQL task should not fail and it should go for the next Task in teh control flow.
How can I do this?
View 4 Replies
View Related
Apr 23, 2008
Hi,
There is an option in ssis to skip one or more header rows, but there isn't any thing to skip one or more footer rows.
Example:
header bla bla
1;"Joe";24;"New York"
2;"John";54;"Washington"
3;"Phil";36;"San Francisco"
footer bla bla
I skip the first record in the source definition. So I have left 4 records. How do I skip the fourth (last) record? The value contains some statistics so I cann't look for a special value. Is there a way to skip the last record with a script component?
Joost
View 5 Replies
View Related
Jun 20, 2007
Hello,
im using sqldatareader to read my data and whenever time i loop through the reader it starts from second row why is that?
here is my code:while (reader.Read()){hinfo.Name = reader["_name"].ToString();hi.Add(hinfo);}
i look at the database and i have two rows but its reading only the second row, skiping the first row
View 2 Replies
View Related
Jan 10, 2008
Hi, I have the code below. I need to skip the first row in the datatable as it has the headers. This works now, but my gridview gets the header row inserted as a record.Private Shared Sub InsertData(ByVal sourceTable As System.Data.DataTable, ByVal destConnection As SqlConnection) ' old method: Lots of INSERT statements ' first, create the insert command that we will call over and over: destConnection.Open() Using ins As New SqlCommand("INSERT INTO [tblAppointmentDisposition] ([contactdate], [dnbnumber], [prospectname], [businessofficer], [phonemeeting], [followupcalldate2], [phonemeetingappt], [followupcalldate3], [appointmentdate], [appointmentlocation], [appointmentkept], [applicationgenerated], [applicationgenerated2], [applicationgenerated3], [comments], [newaccount], [futureopportunity]) VALUES (@contactdate, @dnbnumber, @prospectname, @businessofficer, @phonemeeting, @followupcalldate2, @phonemeetingappt, @followupcalldate3, @appointmentdate, @appointmentlocation, @appointmentkept, @applicationgenerated, @applicationgenerated2, @applicationgenerated3, @comments, @newaccount, @futureopportunity)", destConnection) ins.CommandType = CommandType.Text ins.Parameters.Add("@contactdate", SqlDbType.Text) ins.Parameters.Add("@dnbnumber", SqlDbType.Text) ins.Parameters.Add("@prospectname", SqlDbType.Text) ins.Parameters.Add("@businessofficer", SqlDbType.NVarChar) ins.Parameters.Add("@phonemeeting", SqlDbType.Text) ins.Parameters.Add("@followupcalldate2", SqlDbType.Text) ins.Parameters.Add("@phonemeetingappt", SqlDbType.Text) ins.Parameters.Add("@followupcalldate3", SqlDbType.Text) ins.Parameters.Add("@appointmentdate", SqlDbType.Text) ins.Parameters.Add("@appointmentlocation", SqlDbType.Text) ins.Parameters.Add("@appointmentkept", SqlDbType.Text) ins.Parameters.Add("@applicationgenerated", SqlDbType.Text) ins.Parameters.Add("@applicationgenerated2", SqlDbType.Text) ins.Parameters.Add("@applicationgenerated3", SqlDbType.Text) ins.Parameters.Add("@comments", SqlDbType.Text) ins.Parameters.Add("@newaccount", SqlDbType.Text) ins.Parameters.Add("@futureopportunity", SqlDbType.Text) ' and now, do the work: For Each r As DataRow In sourceTable.Rows For i As Integer = 0 To 16 ins.Parameters(i).Value = r(i) Next ins.ExecuteNonQuery() 'If System.Threading.Interlocked.Increment(rowscopied) Mod 10000 = 0 Then 'Console.WriteLine("-- copied {0} rows.", rowscopied) 'End If Next End Using destConnection.Close() End Sub
View 3 Replies
View Related
Jan 10, 2008
I have this code. It works, but inserts the header row into the gridview. I need to avoid the first row. Protected Sub excelimport(ByVal dataSrc As SqlDataSource, ByVal fileName As String) Dim intFileNameLength As Integer Dim strFileNamePath As String Dim strFileNameOnly As String Dim strpath As String If Not (uploadfile.PostedFile Is Nothing) Then strFileNamePath = uploadfile.PostedFile.FileName intFileNameLength = InStr(1, StrReverse(strFileNamePath), "") strFileNameOnly = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2) 'If File.Exists(paths & strFileNameOnly) Then 'lblMessage.Text = "Image of Similar name already Exist,Choose other name" 'Else If uploadfile.PostedFile.ContentLength > 40000 Then lblmessage.Text = "The Size of file is greater than 4 MB" ElseIf strFileNameOnly = "" Then Exit Sub Else 'strfilename = uploadfile.FileName.Substring(0, (InStr(uploadfile.FileName, ".") - 1)) strFileNameOnly = fileName & ".csv" strpath = "/sites/marketing/apps/disposition/content/excel/" '& strFileNameOnly uploadfile.PostedFile.SaveAs(Server.MapPath(strpath) & strFileNameOnly) 'lblmessage.Text = "File Upload Success." 'Session("Img") = strFileNameOnly Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & (Server.MapPath(strpath)) & ";Extended Properties=""Text;HDR=No;FMT=Delimited""" '"Provider=Microsoft.Jet.OLEDB.4.0;" & _ '"Data Source=" & "/" & strFileNameOnly & ";" & _ '"Extended Properties=Excel 8.0;" Dim conn As New OleDb.OleDbConnection(strConn) Dim myData As New OleDbDataAdapter("SELECT * FROM " & strFileNameOnly, conn) Dim myDatatable As New System.Data.DataTable Dim mySqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("BDOConnectionString").ToString()) ''You must use the $ after the object you reference in the spreadsheet myData.Fill(myDatatable) InsertData(myDatatable, mySqlConnection) 'System.IO.File.Delete(Server.MapPath(strpath)) GridView1.DataBind() upload.Visible = False End If End If ' GridView1.DataSource = myDataset.Tables(0).DefaultView ' GridView1.DataBind() End Sub Private Shared Sub InsertData(ByVal sourceTable As System.Data.DataTable, ByVal destConnection As SqlConnection) ' old method: Lots of INSERT statements ' first, create the insert command that we will call over and over: destConnection.Open() Using ins As New SqlCommand("INSERT INTO [tblAppointmentDisposition] ([contactdate], [dnbnumber], [prospectname], [businessofficer], [phonemeeting], [followupcalldate2], [phonemeetingappt], [followupcalldate3], [appointmentdate], [appointmentlocation], [appointmentkept], [applicationgenerated], [applicationgenerated2], [applicationgenerated3], [comments], [newaccount], [futureopportunity]) VALUES (@contactdate, @dnbnumber, @prospectname, @businessofficer, @phonemeeting, @followupcalldate2, @phonemeetingappt, @followupcalldate3, @appointmentdate, @appointmentlocation, @appointmentkept, @applicationgenerated, @applicationgenerated2, @applicationgenerated3, @comments, @newaccount, @futureopportunity)", destConnection) ins.CommandType = CommandType.Text ins.Parameters.Add("@contactdate", SqlDbType.Text) ins.Parameters.Add("@dnbnumber", SqlDbType.Text) ins.Parameters.Add("@prospectname", SqlDbType.Text) ins.Parameters.Add("@businessofficer", SqlDbType.NVarChar) ins.Parameters.Add("@phonemeeting", SqlDbType.Text) ins.Parameters.Add("@followupcalldate2", SqlDbType.Text) ins.Parameters.Add("@phonemeetingappt", SqlDbType.Text) ins.Parameters.Add("@followupcalldate3", SqlDbType.Text) ins.Parameters.Add("@appointmentdate", SqlDbType.Text) ins.Parameters.Add("@appointmentlocation", SqlDbType.Text) ins.Parameters.Add("@appointmentkept", SqlDbType.Text) ins.Parameters.Add("@applicationgenerated", SqlDbType.Text) ins.Parameters.Add("@applicationgenerated2", SqlDbType.Text) ins.Parameters.Add("@applicationgenerated3", SqlDbType.Text) ins.Parameters.Add("@comments", SqlDbType.Text) ins.Parameters.Add("@newaccount", SqlDbType.Text) ins.Parameters.Add("@futureopportunity", SqlDbType.Text) ' and now, do the work: For Each r As DataRow In sourceTable.Rows If sourceTable.Rows.IndexOf(sourceTable.Rows(0)) Then 'do nothing Else For i As Integer = 0 To 16 ins.Parameters(i).Value = r(i) Next ins.ExecuteNonQuery() 'If System.Threading.Interlocked.Increment(rowscopied) Mod 10000 = 0 Then 'Console.WriteLine("-- copied {0} rows.", rowscopied) 'End If End If Next End Using destConnection.Close() End Sub
View 5 Replies
View Related
Sep 20, 2013
I am looking for best practice when passing a parameter to stored procedure that is not needed. For example, sometime the users will want the list to list only by certain state. Other times the user want all states. How can I make the SP to ignore the where clause if users want all states.
CREATE PROCEDURE usp_Example
@State nvarchar(2)
AS
SELECT FirstName,
LastName,
State
FROM SomeTable
WHERE State = @FirstName;
GO
View 1 Replies
View Related
Jul 23, 2005
Hello All,Does the BCP utility enable you to selectively import rows from a flatfile to a table ?For example:The first column in my flat file contains a record type - 1, 2..7I only need to import types 1, 2, & 3Can this be specified in the .fmt file ?Thanks in advancehharry
View 4 Replies
View Related
Jun 2, 2006
Hence you have a database which huge tables and a transactional replication (push subscriptions).
Now my question:
1. if I have to initialize a snapshot but I would like to do it without the snapshot agent, what methods are available?
2. Usually the distribution agent will request an initialize snapshot. How can I tell him, that I would like to use an alternative method and that the distribution agent should NOT request a snapshot?
3. Any suggestions about a good practive for materializing huge and big tables wihtout using the disitrbution agent (e.g. "switch off" replication, bcp table out of the primary site and bcp it into the target site, "start" distribution agent so that it doesn't request a snapshot).
Regards
Nobsay
View 6 Replies
View Related
May 15, 2007
Hi,
How to skip my 12 header rows from XLS input source?
(before the Excel driver reads (by default, 8 rows) in the specified source to guess at the data type of each column.)
thx,
f.sor
View 3 Replies
View Related
May 20, 2008
I am importing a flatfile and cannot seem to deal with an issue that seems quite simple.
The files have a header row with column names and those rows start with '#'
However sometimes this header row will also be present in the middle of the file.
The Source tries to parse this row and fails
Is there any way to tell the flafile source to skip rows that start with a particular character like comment rows?
View 5 Replies
View Related