lundi 9 février 2015

SQLServer 2005 Full text search component reported error while indexing

Earlier today we had an unexpected server restart and since this time the full text crawl log has a lot of errors and the outstanding batches count is growing quite high, currently at 10K+



2015-02-09 14:45:10.46 spid27s Error '0x80004005' occurred during full- text index population for table or indexed view '[MYDB].[dbo].[FullTextTable]' (table or indexed view ID '1172251281', database ID '6'), full-text key value 0x981EB6385A396244B7AF363247022651. Attempt will be made to reindex it.
2015-02-09 14:45:10.46 spid27s The component 'DwgFilter.dll' reported error while indexing. Component path 'C:\Program Files\IFilterShop\DwgFilter\DwgFilter.dll'.

2015-02-09 14:45:10.46 spid27s Error '0xc000014b' occurred during full-text index population for table or indexed view '[MYDB].[dbo].[FullTextTable]' (table or indexed view ID '1172251281', database ID '6'), full-text key value 0xB95B9A61BF969248A64E363247022489. Attempt will be made to reindex it.
2015-02-09 14:45:10.46 spid27s The component 'thawbrkr.dll' reported error while indexing. Component path 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\thawbrkr.dll'.


Most of these are of the above 2 types. I've tried searching for a solution but for the most part I can't find anything that refers to the above dlls so would appreciate either some pointers or solutions to the issue.


I don't know if these errors were occurring prior to the restart as the logs only start at this time.


samedi 7 février 2015

SQL Replication status

I want to check the if the publisher's status when it stop for reinitialisation can I reinitialisation the publication using C# or SQL command


vendredi 6 février 2015

SqlClient.SqlException (0x80131904) The identifier that starts with

I am using stored procedure as below anyhow for some files i am retreiving following error. What could be the reason?:



System.Data.SqlClient.SqlException (0x80131904): The identifier that starts with 'D:\DISKSEC\TETRAIBMSolution\TETRA\Data\IDJSKDOSD\Parsed\IOPDCVv3995ReportErgfdgfgdfIOPShun_e6c5b926-fb91-484e-bfe0-9c13a96f' is too long. Maximum length is 128.


Stored procedure i am using:



ALTER PROCEDURE [dbo].[BulkInsertDelimeted]
@InputFileName Varchar(700),
@TableName Varchar(200)
AS
BEGIN
declare @query varchar(6000)
set @Query ='BULK INSERT "' + @TableName + '" FROM "'+ @InputFileName+'"
WITH ( DATAFILETYPE = ''char'', FIELDTERMINATOR = '','' , ROWTERMINATOR = ''\n'')';
print @query
exec (@query)
END

jeudi 5 février 2015

Sending an email from a stored procedure in SQL Server 2005

I am trying to get a stored procedure to work in SQL Server 2005 that was written for SQL Server 2000. It sends an email when called from an application. I tried to run the first part of the stored procedure that creates an OLE object. The 2005 Server is 32-bit. I get the error:


OLE Automation error Information HRESULT: 0x80040154 Source: ODSOLE Extended Procedure Description: Class not registered


This is the query that I am running:



DECLARE @object int
DECLARE @hr int
DECLARE @property varchar(255)
DECLARE @return varchar(255)

EXEC @hr = sp_OACreate '{DB486713-E4A9-11D3-AC19-00C04FA308B2}', @object OUT
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END


I don't know what kind of object that is created from the CLSID. There is no documentation.


Does anyone know why I am getting this error?


THanks.


asp.net Sql Server 2005 how to Combine Multiple Record Values into One Column

I have 5 tables ( movies – categories - movie-catecories - directors-Movie_Directors )


movies movie_Id int title varchar (50)

image varchar(100)


categories cat_Id int cat_name varchar(50)


movie-catecories MovieCatrgory_ID int cat_Id int movie_Id int


directors director_Id int Name varchar(50)


Movie_Directors


MovieDirectors_ID int movie_Id int director_Id int DirectorName varchar(50)


movies


movie_Id title image 1 Hyde Park on Hudson movies/1.jpg 2 Playing for Keeps movies/2.jpg 3 Cheerful Weather for the Wedding movies/3.jpg 4 Heleno movies/4.jpg 8 Deadfall movies/6.jpg


categories


Cat_Id Cat-name 1 Drama 2 Romance 3 Comedy 4 Romance 5 Crime


movie-catecories


MovieCatrgory_ID Cat_Id movie_Id 1 1 1 2 1 2 3 2 3 4 2 4 5 3 8


Directors


Director_ID Name 1 Roger Michell 2 Gabriele Muccino 3 Donald Rice 4 José Henrique Fonseca 5 Sung-Hee Jo


Movie_Directors MovieDirectors_ID movie_Id director_Id DirectorName 1 1 1 Roger Michell 2 1 2 Gabriele Muccino 4 1 3 Donald Rice 5 2 4 José Henrique Fonseca 6 2 5 Sung-Hee Jo



SELECT DISTINCT movies.movie_Id, movies.title, movies.image, Movie_Directors.DirectorName, Movie_Directors.director_Id


FROM movies INNER JOIN Movie_Directors ON movies.movie_Id = Movie_Directors.movie_Id CROSS JOIN directors WHERE (movies.title LIKE '%' + @title + '%')


**Result


Movie_ID tittle image DirectorName director_Id 1 Hyde Park on Hudson movies/1.jpg Roger Michell 1 1 Hyde Park on Hudson movies/1.jpg Gabriele Muccino 2 1 Hyde Park on Hudson movies/1.jpg Donald Rice 3


I want to combine the DirectorName in one record like this


Movie_ID tittle image DirectorName director_Id 1 Hyde Park on Hudson movies/1.jpg Roger Michell, Gabriele Muccino, Donald Rice 1-2-3


I have problem in this code to combine the DirectorName in one record Please help me **



SELECT DISTINCT movies.movie_Id, movies.title, movies.image,


substring( (select ‘; ‘ +Movie_Directors . DirectorName from Movie_Directors inner join movies on Movie_Directors.movie_Id = movies.movie_Id



for xml path(”)), 3, 1000) as CombineDirectorName


FROM movies INNER JOIN Movie_Directors ON movies.movie_Id = Movie_Directors.movie_Id CROSS JOIN directors WHERE (movies.title LIKE '%' + @title + '%')


and display the result in Repeater:



<asp:Repeater ID="Repeater1" runat="server" >
<HeaderTemplate> </HeaderTemplate>
<ItemTemplate>
<div style="width:100%;">

<div class="excerpt">
<a href="movie_details.aspx?id=<%# DataBinder.Eval(Container.DataItem, "movie_Id")%>" class="thumb" title="An image"><img src="<%# DataBinder.Eval(Container.DataItem, "image")%>" alt="Post" style="opacity: 1; float:left; width:80px ; height:100px; border:3px solid #fff ; margin:5px;"></a>
<a href="movie_details.aspx?id=<%# DataBinder.Eval(Container.DataItem, "movie_Id")%>" class="header"><h6><%# DataBinder.Eval(Container.DataItem, "title")%>


<%# DataBinder.Eval(Container.DataItem, " Movie_Directors . DirectorName ")%>



</div>
</div><br />


<hr />
</ItemTemplate>
</asp:Repeater>


C#


protected void LinkButton1_Click(object sender, EventArgs e) {



string cat_id = DropDownList1.SelectedValue;
string keyword = TextBox1.Text;
int? cid = int.Parse(cat_id);

Repeater1.DataSource = dc.StoredProcedure1(TextBox1.Text, TextBox1.Text, cid);
Repeater1.DataBind();

}

Does SqlDataReader transfer 2nd set before, or as part of, .NextResult

When using the SqlDataReader class in .NET 4.0 to return multiple sets of data from a stored procedure, does it transfer ALL the data from SQL Server for ALL the sets from the start - or does it only transfer subsequent sets of data on each call to .NextResult()?


Or to put it another way: If I failed to call .NextResult() would it still go through the process of transferring the data for the 2nd data set?


I have a stored procedure that potentially returns thousands of rows of data, and I would like to be able to split the stored procedure into two parts:



  • Data set 1: a scalar value which denotes the number of rows that will be returned

  • Data set 2: the actual rows


In an ideal world I would like to be able to call this stored-procedure, and if the scalar value is under a pre-set number then call .NextResult() and then process the rows from the 2nd data set. And if the scalar value is over the pre-set, then not calling .NextResult() will not require the data to be transferred from the SQL Server.


The simple solution is to have two stored procedures (one to return the number of rows, the other to return the rows)... or have a flag on a single stored procedure to return the number of row or actual rows, and call it twice.


Finding job owner of a SQL Agent job

I want to find all the jobs which are created by anyone other than sa.


I'm using below query:



select s.name,l.name
from msdb..sysjobs s
left join master.sys.syslogins l on s.owner_sid = l.sid


But owner name comes as null for users who are not part of server log in. Will the name or user id will be stored in any sys tables?