.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Selecting Particular Commands with sp_repldone

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
Is it possible to use sp_repldone to mark all commands distributed up to a certain point? We have a scenario where the log reader is unable to construct a command from one problematic command. Log Reader Agent failed to construct a replicated command from log sequence number (LSN) {0000fc2c:000afd81:0009}. Back up the publication database and contact Customer Support Services. (Source: MSSQLServer, Error number: 18805) In order to correct this problem we issue the following: EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1 EXEC sp_replflush GO Unfortunately, this marks all commands as being distributed, even the commands that occurred after the problematic one.  From BOL it seems as though it’s possible to mark the problematic command and all earlier commands as distributed. (With sp_repldone, you can manually tell the server that a transaction has been replicated (sent to the Distributor). It also allows you to change the transaction marked as the next one awaiting replication. You can move forward or backward in the list of replicated transactions. (All transactions less than or equal to that transaction are marked as distributed.)) Does anyone know how to do this? I found an interesting article which discusses this but it’s from 2003 so I’m reluctant to rely on it in a production system. http://www

View Complete Post

More Related Resource Links

ASP.Net Gridview Edit Update Cancel Commands

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

Advanced WPF: Understanding Routed Events And Commands In WPF


See how routed events and routed commands in Windows Presentation Foundation form the basis for communication between the parts of your UI.

Brian Noyes

MSDN Magazine September 2008

Cmdlets: Extend Windows PowerShell With Custom Commands


Jim Truher presents an introduction to writing and registering your own custom cmdlets to be used in Windows PowerShell.

Jim Truher

MSDN Magazine December 2007

.NET Reflection: Dynamically Bind Your Data Layer to Stored Procedures and SQL Commands Using .NET M


One major inconvenience of using SQL stored procedures from code is having to match type information. You have to write long wrapper functions around the procedures just to expose the data types. In the .NET Framework, however, the reflection services of the System.Reflection namespace allow you to query rich metadata that describe data types. This article explains how to use reflection in .NET to end your stored procedure nightmares. The author creates four custom classes, including one that generates a SQLCommand object based on the metadata of a method. Using this library, you'll be on your way to automating the generation of stored procedures.

Atif Aziz

MSDN Magazine August 2002

Error message when selecting a row in webdatagrid



I have a webdatagrid control that is loaded by using an sqldatasource.  I have add and edit methods that behave correctly, however, I have a problem when I delete a row.   I can delete the row correctly from the datagrid and the database, but as soon as I select another row in the grid straight after, I get an error:

Microsoft JScript runtime error: 'undefined' is null or not an object


There are no events wired up to the row select, so it doesn't appear to be that.


Can anyone help?


Help needed in selecting coulmns from 2 tables using entity framework


Hi all,

I have two tabels as mentioned below. I am using entity framework and vs2010.I am not able to write linq query to get data from both the tables. there is one to many relationship(for one category ther can be multiple articles). Please help me out as this is very urgent. Thanks in advance.

1) Article

ArticleID bigint Unchecked
CategoryID int Unchecked
ArticleName varchar(500) Unchecked
ArticleDesc nchar(1024) Unchecked

DropDownList and TemplateInfo not selecting proper value


I am having trouble with DropDownList (and/or DropDownListFor) when using TemplateInfo's HtmlFieldPrefix in a strongly-typed view.  DropDownList properly selects the value from the model when the prefix hos not been site.  Once I set the value of HtmlFieldPrefix, the value from the model is not selected in the drop-down list.

I am using .NET 3.5SP1 and ASP.NET MVC 2 RC2.


public class TestModel
    public string Text { get; set; }
    public string Option { get; set; }

    public IEnumerable<String> Options
            yield return "One";
            yield return "Two";
            yield return "Three";


public class TestController : Controller
    public ActionResult Test()
        return View(new TestModel

Why won't my Model accept what I'm selecting from the DropDownList?


I edit the Dinner (from the NerdDinner tutorial) and save it, but the Country isn't persisted. Here's my code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace NerdDinner.Models
public class DinnerFormViewModel
private static string[] _countries = new[]{

public Dinner Dinner { get; private set; }
public SelectList Countries { get; private set; }

public DinnerFormViewModel(Dinner dinner)
Dinner = dinner;
Countries = new SelectList(_countries, dinner.Country);

Then in my controller I use it like so:
    public ActionResult Edit(int id)
        Dinner dinner = dinnerRepository.GetDinner(id);        

Filtering/selecting rows based on date


I have a gridview, based on thsi datasource:


<asp:SqlDataSource ID="SqlDataSourceAllLoads" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tplatz_dk_dbConnectionString %>"               
        SelectCommand="SELECT DISTINCT DATEADD(day, 0, DATEDIFF(day, 0, tblDelivered.delivered_Date)) AS delivered_Date, tblDelivered.delivered_LoadNo, tblDelivered.delivered_TrailerNo, ISNULL(tblDeliveredInfo.deliveryInfo_FirmaNavn, N'?') AS Expr1 FROM tblDelivered FULL OUTER JOIN tblDeliveredInfo ON tblDelivered.delivered_LoadNo = tblDeliveredInfo.deliveryInfo_LoadNr ORDER BY delivered_Date DESC">

Using a dropdownlist, I can filter (by changing datasource) the results based on customer names in a dropdownlist. This datasource, working perfectly, looks like this:


<asp:SqlDataSource ID="sqldataSourceKundeLoads" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tplatz_dk_dbConnectionString %>" 
        SelectCommand="SELECT  DATEADD(day, 0, DATEDIFF(day, 0, tblDelivered.delivered_Date)) AS delivered_Date, tblDelivered.delivered_LoadNo, tblDelivered.delivered_TrailerNo, ISNULL(tblDeliveredInfo.deliveryInfo_FirmaNavn, N'?&#

selecting between query and stored procedure

<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1033506322; mso-list-type:hybrid; mso-list-template-ids:369124590 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> What would prefer to pull data out from sources stored procedure or query? and why?

Selecting the correct auto-generated ID associated with a given customer

I have the following two tables (among many) in an OLTP database: TABLE NAME: BusinessEntity TABLE FIELDS: BusinessEntityID, int, IDENTITY(1,1), NOT NULL, PRIMARY KEY BusinessEntityType, nvarchar(10), NULL TABLE NAME: Person TABLE FIELDS: BusinessEntityID, int, NOT NULL, PRIMARY KEY, FOREIGN KEY to BusinessEntity.BusinessEntityID FirstName, nvarchar(30), NULL LastName, nvarchar(30), NULL There is a 1-to-1 Identifying Relationship between the BusinessEntity and Person tables. When a new customer needs to be added to the database, I execute the following T-SQL statement: INSERT INTO BusinessEntity (BusinessEntityType) VALUES (‘Customer’); What I don’t know how to do is retrieve the value of BusinessEntity.BusinessEntityID that was automatically assigned to the new customer so I can then append it to Person.BusinessEntityID. While I know I can execute: SELECT MAX (BusinessEntityID) FROM BusinessEntity; there is no guarantee that the BusinessEntityID will be the one associated with the new customer I just added because it is possible that other new customers can be added to the BusinessEntity table by other users during the interim period between the time I execute the previously mentioned INSERT command and then SELECT command. Any help/guidance in resolving this issue would be greatly appreciated.  Thanks.

Selecting the Appropriate Type of Replication

I have 2 servers 1) Production Server 2) Reporting Server I create seprate tables for reports at production sever. I fill those table from stored procedure thru sql job daily. First i truncate the tables then insert whole data in reporting tables each time. So now i have to implement replication to replicate the reporting tables data to reporting server database. I wan't to know which type of replication is used (Snapshot, Transactional, Merge).    

can alias in select be used for selecting other column in that table?

Hi All,I want to use an alias name in a select clause to select other column in that table? select   top 1 (   case when CreatedByName <> '' then 'yy'         else 'xx' end) as filName, (filName + 'xx')from Order       But it throws error like " Invalid column name 'fileName'."Could you please help me out?

Selecting VIEW dynamically from a stored procedure

What's the best way to dynamically reference a view in a sproc? I want to pass a View Name into a stored procedure, but I'm guessing this is only possible with a table in SQL Server 2008. Is the only way to do this through dynamic SQL (passing in the View name as a string, and executing the query as a built string)?. My concern is that if I use Dynamic SQL, what performance gain I might get by using a view may be undone by using Exec('string').   Any thoughts?   Thanks Steve

A FocusScope Nightmare (Bug?): Commands Are Disabled

I've got a simple menu with some simple commands:   Code Snippet <Menu> <MenuItem Header="Edit"> <MenuItem Command="ApplicationCommands.Cut" /> <MenuItem Command="ApplicationCommands.Copy" /> </MenuItem> </Menu>     I've got a simple control:   Code Snippet <UserControl x:Class="WpfApplication2.UserControlRed" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid /> </UserControl>     The code-behind for this control enables handling the 'Cut' command: Code Snippet   public partial class UserControlRed : UserControl { public UserControlRed() { InitializeComponent(); this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, this.OnCut, this.OnAlwaysExecute)); } public void OnCut(object sender, RoutedEventArgs routedEventArgs) { Console.WriteLine("Cut"); } private void OnAlwaysExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; } }     This control is added to a simple page so it can be navigated to using a Frame:   Code Snippet <!-- The Menu Commands are enabed with this code. --> <Page x:Class="WpfApplication2.PageRed" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x=&
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend