Showing posts with label express. Show all posts
Showing posts with label express. Show all posts

Tuesday, March 20, 2012

Combine Rows in Search Result

In Sql Server 2005 Express I have this table:

CREATE TABLE [dbo].[Sections](
[SectionID] [int] NOT NULL,
[DocumentNo] [smallint] NULL,
[SequenceNo] [smallint] NULL,
[SectionNo] [smallint] NULL,
[DocumentTypeID] [smallint] NULL,
[SectionText] [ntext] NULL)

Each paragraph of text (SectionText) is in its own row(SectionNo) Each primary document has a DocumentTypeID of 1 withthree subdocument types (2=Index, 3=Background, 4=Report).

I run this query and return a collection of single rows from various documents grouped together by DocumentNo:

SELECT *
FROM Sections
WHERE CONTAINS (SectionText, 'exercise')
ORDER BY DocumentNo

For each row that contains the search term, I would like toreturn the full document (all rows as parapraphs within one row ofreturned data). In other words, I want to reconstitute the fulldocument as it existed prior to being inserted into the database withparagraph separation.

For exampe, if the search term is in row 3of DocumentNo=5, DocumentTypeID=2, I want to return all the rows ofthat document in one block of text that retains paragraph format(preferablly with a line break and carriage return betweenparagraphs). How can this be done?

You can do this trick which will lead you to solve the problem.

Okay, let say you need to group each page's paragraph in one record insted of many records (as in your current case).

Step#1:

So, Create another table with following columns :
1) BookID: Int or smallint
2) PageID: Int or smallint
3) PageText: Text or NText

Step#2:

1) Do acursor that will loop throug all of theparagraphs related to aspecific page.
2) DoINSERT thefirst record into thePageText field of thenew created table, while you doUPDATEfor therest of recordsafter concatenatingthem with value already exists in thePageText field.

Step#3:

Do this for each page in each book.

Result:

At the end you will have one table from which you can query and seach about any word/paragraph in any page in any book!!

Good luck.

|||

Thanks for the suggestion. I will give it a try.

Sunday, March 11, 2012

COM Plus Catalog Requirement (Warning) Com+ Failure SQL 2005 Express Bootstrap

- COM Plus Catalog Requirement (Warning)

Messages

COM Plus Catalog Requirement

If SQL Server Setup fails, Setup will roll back the installation but may not remove all .manifest files. The workaround is to rename the files and then rerun Setup. For more information, see How to: Work Around COM+ Check Failure in SQL Server Setup.

Workaround says remove the .manifest files. Where are they?

SETUP CONTINUES TO FAIL

Hi,

I also encountered same problem.

The workaround is go to Add/Remove program, click on Add/Remove Windows component and click on the next button till end. This will reconfigure the windows component.

I did this on my server, and it worked.

Cheers,

Avi

|||

I too have the same problem and still doesn't work after going through Add/Remove Windows component steps. Very frustrating!

|||

Any solution ?

I am facing with the same problem

|||same to me, have the same error msg|||I'm having the same problem and cannot get around it ...|||

Check that the distributed transaction coordinator (MSDTC) service is started.

I had the same problem so I went to check the com+ applications on my computer (Control panel\administrative tools\Componant services\Computers\My Computer\Com+ Applications).

I could not open the "computers" folder and got an error indicating that MSDTC was not running. (I had disabled this service some time ago).

Upon starting MSDTC I was able to open the computers folder and check the COm+ applications.

Anyway, to cut a long story short, set MSDTC service to automatic, restart the SQL Server 2005 install and you should not get the error again.

|||I am having this problem, and MSDTC isn't even showing in the Services Control Panel. It's as if it's not installed. Any ideas on what I can try next? I know I could try reinstalling Windows XP, but I'd rather not.|||Add/Remove Windows Components -> Application Server -> Enable Network COM+ access

COM Plus Catalog Requirement (Warning) Com+ Failure SQL 2005 Express Bootstrap

- COM Plus Catalog Requirement (Warning)

Messages

COM Plus Catalog Requirement

If SQL Server Setup fails, Setup will roll back the installation but may not remove all .manifest files. The workaround is to rename the files and then rerun Setup. For more information, see How to: Work Around COM+ Check Failure in SQL Server Setup.

Workaround says remove the .manifest files. Where are they?

SETUP CONTINUES TO FAIL

Hi,

I also encountered same problem.

The workaround is go to Add/Remove program, click on Add/Remove Windows component and click on the next button till end. This will reconfigure the windows component.

I did this on my server, and it worked.

Cheers,

Avi

|||

I too have the same problem and still doesn't work after going through Add/Remove Windows component steps. Very frustrating!

|||

Any solution ?

I am facing with the same problem

|||same to me, have the same error msg|||I'm having the same problem and cannot get around it ...|||

Check that the distributed transaction coordinator (MSDTC) service is started.

I had the same problem so I went to check the com+ applications on my computer (Control panel\administrative tools\Componant services\Computers\My Computer\Com+ Applications).

I could not open the "computers" folder and got an error indicating that MSDTC was not running. (I had disabled this service some time ago).

Upon starting MSDTC I was able to open the computers folder and check the COm+ applications.

Anyway, to cut a long story short, set MSDTC service to automatic, restart the SQL Server 2005 install and you should not get the error again.

|||I am having this problem, and MSDTC isn't even showing in the Services Control Panel. It's as if it's not installed. Any ideas on what I can try next? I know I could try reinstalling Windows XP, but I'd rather not.|||Add/Remove Windows Components -> Application Server -> Enable Network COM+ access

COM Plus Catalog Requirement (Warning) Com+ Failure SQL 2005 Express Bootstrap

- COM Plus Catalog Requirement (Warning)

Messages

COM Plus Catalog Requirement

If SQL Server Setup fails, Setup will roll back the installation but may not remove all .manifest files. The workaround is to rename the files and then rerun Setup. For more information, see How to: Work Around COM+ Check Failure in SQL Server Setup.

Workaround says remove the .manifest files. Where are they?

SETUP CONTINUES TO FAIL

Hi,

I also encountered same problem.

The workaround is go to Add/Remove program, click on Add/Remove Windows component and click on the next button till end. This will reconfigure the windows component.

I did this on my server, and it worked.

Cheers,

Avi

|||

I too have the same problem and still doesn't work after going through Add/Remove Windows component steps. Very frustrating!

|||

Any solution ?

I am facing with the same problem

|||same to me, have the same error msg|||I'm having the same problem and cannot get around it ...|||

Check that the distributed transaction coordinator (MSDTC) service is started.

I had the same problem so I went to check the com+ applications on my computer (Control panel\administrative tools\Componant services\Computers\My Computer\Com+ Applications).

I could not open the "computers" folder and got an error indicating that MSDTC was not running. (I had disabled this service some time ago).

Upon starting MSDTC I was able to open the computers folder and check the COm+ applications.

Anyway, to cut a long story short, set MSDTC service to automatic, restart the SQL Server 2005 install and you should not get the error again.

|||I am having this problem, and MSDTC isn't even showing in the Services Control Panel. It's as if it's not installed. Any ideas on what I can try next? I know I could try reinstalling Windows XP, but I'd rather not.

COM Plus Catalog Requirement (Warning) Com+ Failure SQL 2005 Express Bootstrap

- COM Plus Catalog Requirement (Warning)

Messages

COM Plus Catalog Requirement

If SQL Server Setup fails, Setup will roll back the installation but may not remove all .manifest files. The workaround is to rename the files and then rerun Setup. For more information, see How to: Work Around COM+ Check Failure in SQL Server Setup.

Workaround says remove the .manifest files. Where are they?

SETUP CONTINUES TO FAIL

Hi,

I also encountered same problem.

The workaround is go to Add/Remove program, click on Add/Remove Windows component and click on the next button till end. This will reconfigure the windows component.

I did this on my server, and it worked.

Cheers,

Avi

|||

I too have the same problem and still doesn't work after going through Add/Remove Windows component steps. Very frustrating!

|||

Any solution ?

I am facing with the same problem

|||same to me, have the same error msg|||I'm having the same problem and cannot get around it ...|||

Check that the distributed transaction coordinator (MSDTC) service is started.

I had the same problem so I went to check the com+ applications on my computer (Control panel\administrative tools\Componant services\Computers\My Computer\Com+ Applications).

I could not open the "computers" folder and got an error indicating that MSDTC was not running. (I had disabled this service some time ago).

Upon starting MSDTC I was able to open the computers folder and check the COm+ applications.

Anyway, to cut a long story short, set MSDTC service to automatic, restart the SQL Server 2005 install and you should not get the error again.

|||I am having this problem, and MSDTC isn't even showing in the Services Control Panel. It's as if it's not installed. Any ideas on what I can try next? I know I could try reinstalling Windows XP, but I'd rather not.

COM Plus Catalog Requirement (Warning) Com+ Failure SQL 2005 Express Bootstrap

- COM Plus Catalog Requirement (Warning)

Messages

COM Plus Catalog Requirement

If SQL Server Setup fails, Setup will roll back the installation but may not remove all .manifest files. The workaround is to rename the files and then rerun Setup. For more information, see How to: Work Around COM+ Check Failure in SQL Server Setup.

Workaround says remove the .manifest files. Where are they?

SETUP CONTINUES TO FAIL

Hi,

I also encountered same problem.

The workaround is go to Add/Remove program, click on Add/Remove Windows component and click on the next button till end. This will reconfigure the windows component.

I did this on my server, and it worked.

Cheers,

Avi

|||

I too have the same problem and still doesn't work after going through Add/Remove Windows component steps. Very frustrating!

|||

Any solution ?

I am facing with the same problem

|||same to me, have the same error msg|||I'm having the same problem and cannot get around it ...|||

Check that the distributed transaction coordinator (MSDTC) service is started.

I had the same problem so I went to check the com+ applications on my computer (Control panel\administrative tools\Componant services\Computers\My Computer\Com+ Applications).

I could not open the "computers" folder and got an error indicating that MSDTC was not running. (I had disabled this service some time ago).

Upon starting MSDTC I was able to open the computers folder and check the COm+ applications.

Anyway, to cut a long story short, set MSDTC service to automatic, restart the SQL Server 2005 install and you should not get the error again.

|||I am having this problem, and MSDTC isn't even showing in the Services Control Panel. It's as if it's not installed. Any ideas on what I can try next? I know I could try reinstalling Windows XP, but I'd rather not.

COM Plus Catalog Requirement (Warning) Com+ Failure SQL 2005 Express Bootstrap

- COM Plus Catalog Requirement (Warning)

Messages

COM Plus Catalog Requirement

If SQL Server Setup fails, Setup will roll back the installation but may not remove all .manifest files. The workaround is to rename the files and then rerun Setup. For more information, see How to: Work Around COM+ Check Failure in SQL Server Setup.

Workaround says remove the .manifest files. Where are they?

SETUP CONTINUES TO FAIL

Hi,

I also encountered same problem.

The workaround is go to Add/Remove program, click on Add/Remove Windows component and click on the next button till end. This will reconfigure the windows component.

I did this on my server, and it worked.

Cheers,

Avi

|||

I too have the same problem and still doesn't work after going through Add/Remove Windows component steps. Very frustrating!

|||

Any solution ?

I am facing with the same problem

|||same to me, have the same error msg|||I'm having the same problem and cannot get around it ...|||

Check that the distributed transaction coordinator (MSDTC) service is started.

I had the same problem so I went to check the com+ applications on my computer (Control panel\administrative tools\Componant services\Computers\My Computer\Com+ Applications).

I could not open the "computers" folder and got an error indicating that MSDTC was not running. (I had disabled this service some time ago).

Upon starting MSDTC I was able to open the computers folder and check the COm+ applications.

Anyway, to cut a long story short, set MSDTC service to automatic, restart the SQL Server 2005 install and you should not get the error again.

|||I am having this problem, and MSDTC isn't even showing in the Services Control Panel. It's as if it's not installed. Any ideas on what I can try next? I know I could try reinstalling Windows XP, but I'd rather not.

COM ADO and SQLXML v3

Hi,

I'm in the process of updating an HTA hosted application to SQL Server 2005 Express, using javascript with ADO for database access. I have one function to which I pass an SQLXML query template or updategram for all database queries and updates:

function doSql(sXml) {
var cmd = new ActiveXObject('ADODB.Command');
var conn = new ActiveXObject('ADODB.Connection');
var strmIn = new ActiveXObject('ADODB.Stream');
var strmOut = new ActiveXObject('ADODB.Stream');
var xml = new ActiveXObject(sDOM);
xml.async = false;

try {
conn.Provider = "SQLOLEDB";
conn.Open("Provider=SQLOLEDB.1;Persist Security Info=True;"+
"Initial Catalog=CGIS;Server=(local)\\ocean;Integrated Security=SSPI;");
conn.Properties("SQLXML Version") = "SQLXML.3.0";
cmd.ActiveConnection = conn;
cmd.Dialect = "{5d531cb2-e6ed-11d2-b252-00c04f681b71}";
strmIn.Open();
strmIn.WriteText(sXml);
strmIn.Position = 0;
cmd.CommandStream = strmIn;
strmOut.Open();
cmd.Properties("Output Stream").Value = strmOut;
cmd.Properties("Output Encoding").Value = "UTF-16";
var iCount;
cmd.Execute(iCount, null, 0x400);
conn.Close();
xml.load(strmOut);
return xml;
} catch(e) { alert('A database error occured: \n'+e.description+'\n\nQuery:\n'+sXml); }

I understand that SQLServer 2005 has SQLXML built in, which can be accessed using ADO.Net. Can it also be accessed using COM ADO? When I changed the connection string to this:

conn.Open("Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=\\.\pipe\SQLLocal\SQLEXPRESS");

I get this error:

'A database error occured:
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].'

Sounds like a connection string error however this was the connection string I pulled out of a .udl file that connected successfully.

Any help/suggestions greatly appreciated!

Andrew

Try changing the provider to see if that's it. My bet is that it is something to do with the network connection settings, so look in Books Online in the Database Engine section to learn more about the settings and various issues they have. You can also check out this article:

http://support.microsoft.com/default.aspx/kb/914277

Buck Woody

COM ADO and SQLXML v3

Hi,

I'm in the process of updating an HTA hosted application to SQL Server 2005 Express, using javascript with ADO for database access. I have one function to which I pass an SQLXML query template or updategram for all database queries and updates:

function doSql(sXml) {
var cmd = new ActiveXObject('ADODB.Command');
var conn = new ActiveXObject('ADODB.Connection');
var strmIn = new ActiveXObject('ADODB.Stream');
var strmOut = new ActiveXObject('ADODB.Stream');
var xml = new ActiveXObject(sDOM);
xml.async = false;

try {
conn.Provider = "SQLOLEDB";
conn.Open("Provider=SQLOLEDB.1;Persist Security Info=True;"+
"Initial Catalog=CGIS;Server=(local)\\ocean;Integrated Security=SSPI;");
conn.Properties("SQLXML Version") = "SQLXML.3.0";
cmd.ActiveConnection = conn;
cmd.Dialect = "{5d531cb2-e6ed-11d2-b252-00c04f681b71}";
strmIn.Open();
strmIn.WriteText(sXml);
strmIn.Position = 0;
cmd.CommandStream = strmIn;
strmOut.Open();
cmd.Properties("Output Stream").Value = strmOut;
cmd.Properties("Output Encoding").Value = "UTF-16";
var iCount;
cmd.Execute(iCount, null, 0x400);
conn.Close();
xml.load(strmOut);
return xml;
} catch(e) { alert('A database error occured: \n'+e.description+'\n\nQuery:\n'+sXml); }

I understand that SQLServer 2005 has SQLXML built in, which can be accessed using ADO.Net. Can it also be accessed using COM ADO? When I changed the connection string to this:

conn.Open("Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=\\.\pipe\SQLLocal\SQLEXPRESS");

I get this error:

'A database error occured:
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].'

Sounds like a connection string error however this was the connection string I pulled out of a .udl file that connected successfully.

Any help/suggestions greatly appreciated!

Andrew

Try changing the provider to see if that's it. My bet is that it is something to do with the network connection settings, so look in Books Online in the Database Engine section to learn more about the settings and various issues they have. You can also check out this article:

http://support.microsoft.com/default.aspx/kb/914277

Buck Woody

Saturday, February 25, 2012

Column Names - Modifing

Can the column names be change in SQL Express.

I am amist of pulling my hair out here, I have got a scenerio of needing to be able to move data around, my first thought was to have two columns, one for the data and the other for the column name. Once getting into the manipulation of the data, it occurred. MUCH EASIER to modify the column name in the data table rather the data.

Is it possible from VB to change the name of the column in the database table?

Thanks Again

Davids Learning

Use sp_rename

create table test
(
trestId int
)
go

exec sp_rename 'test.trestId','testId','Column'

go

select *
from test

testId
--

|||

Ok

You can call me a dummy here,

Can you explain this a little bit more. I havent done a whole lot with TSQL,

and also, is this in VB?

Very Confused

Davids Learning

|||

No, the stuff in bold is the code you would use from management studio (2005) or query analyzer (2000):

create table test
(
trestId int
)
go

exec sp_rename 'test.trestId','testId','Column'

go

select *
from test

The other stuff was setup to show you how it worked. If you don't know how to execute queries, you might ask for a prod in the right direction in the VB forums:

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=32&SiteID=1

These forums are for how to write TSQL, which is its own language...

Sunday, February 12, 2012

Collation troubles with SQLServer Express 2005

Greetings,
I installed SQL Server Express 2005 in my system, and created a simple database to store mailng addresses. The database has an email field and a name field. The data to populate the database came from an Excel file saved as a Unicode Text file containing the data as:
xxx@.somemail.com; To?o Peres yyy@.someothermail.com; Iván Cárdenas Note that this data has names with accented characters.
I then tried to import the data into the SQLServer Express with the following command:
bulk insert lista
from 'c:\temp\todas.csv'
with (
DATAFILETYPE ='widechar',
FIELDTERMINATOR =';'
)
I got the following error message:
Bulk load: DataFileType was incorrectly specified as widechar. DataFileType will be assumed to be char because the data file does not have a Unicode signature.
And the data was imported as:
xxx@.somemail.com To±o Peres yyy@.someothermail.com Ivfn C?rdenas
I tried using the DATAFILETYPE ='native' and DATAFILETYPE ='widenative' options but these caused the following error:
Msg 4866, Level 16, State 7, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

I want to avoid re-installing the server and the Express 2005 edition does not come with the tools needed to rebuild the master database anyway (see this link).
When I type the data with the Server Management Studio Express program, I can insert the accented characters correctly.
Does anyone out there know how to deal with this problem? How do I tell SQL Server Express 2005 to insert the text from the text file and keep the accented characters as they were initially?
I will welcome any help.
Ivan.

Hi Ivan,

Are you sure you saved the spreadsheet as Unicode Text? The .csv filetype suggests you didn't - unless you manually changed it.

I tried using the data above in Excel, saving as Unicode Text and then bulk inserting and it worked fine.

Thanks