Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Monday, March 12, 2012

Middle Search Support

Some of the databases that I inherited contain search that are based on finding a string anywhere within a last name such as:

WHERE lastName like '%smith%'

It is desired that each of these names be returned:

Smith
Smithson
Nesmith

What is presently done is that updates to the last name fields trigger that substrings of the last name be sent off into a substring table wtih retention of no 2-char substrings. For these three last names the following would be kept:

(1) Smith, (2) mith, (3) ith and (4) th
(1) Smithson, (2) mithson, (3) ithson, ..., (n) on
(1) Nesmith, (2) esmith, (3) smith, ... (n) th

The where now becomes

WHERE lastNameSub like 'smith%'

This seems to make the search routine by last name faster. I would like to improve on this if I can. Suggestions?

Dave

Hello Dave,

I'm afraid you can't within the core engine alone. Obviously a good indexing strategy will help you, but if we're talking about improving the substring/like search on a character column, apart from indexing, you don't have many options.

As you've discovered, using 'smith%' is much faster then '%smith%' as the optimiser has the opportunity to perform an index scan in the first instance - it does not in the second.

If you are performing a lot of these types of searches, I would look at full-text search:

http://www.databasejournal.com/features/mssql/article.php/3441981

http://www.sql-server-performance.com/tb_search_optimization.asp

Cheers,

Rob

Friday, February 24, 2012

Microsoft SqlServer Desktop Engine Connection Problem

i installed the MSDE2000A on server and i tried to connect from client machine through vb Application using connection string. Server anad client are in LAN. but Some systems able to connect and some systems are unable to connect.

i am getting the error:

"SqlServer does not exist or access denied "

for non connected machines.

the server is listening from these machines. but not connecting to MSDE.

can anyone give me solution what may be the cause.Ensure the System DSN used and login must have required privileges to connect to SQL server.

What is the authentication mode used?

Try:
1. Make sure the SQL server is on
2. Ping the server machine
3. Try connecting to the IP address rather than the server name

Review information from this KBA (http://support.microsoft.com/default.aspx?scid=kb;en-us;328306) for potential causes and resolve it.|||i am using user authentication mode.
i have set DISABLENETWORKPROTOCOLS=0
i have done pinging through IP Address.
i am able ping database.
after doing all these test .. still getting same error...

is there any other possibilities....

Originally posted by Satya
Ensure the System DSN used and login must have required privileges to connect to SQL server.

What is the authentication mode used?

Try:
1. Make sure the SQL server is on
2. Ping the server machine
3. Try connecting to the IP address rather than the server name

Review information from this KBA (http://support.microsoft.com/default.aspx?scid=kb;en-us;328306) for potential causes and resolve it.|||Review points listed in the knowledgebase article.

i am using user authentication mode.
SQL Server does have only 2 modes - Windows only or mixed. Which on e is yours?

i have set DISABLENETWORKPROTOCOLS=0
Don't know about this protocol in SQL, it should be named-pipes, TCP/ip or Multi-protocol. From Start--> programs --> goto MSSQLServer program group and select Server network utility and check for enabled protocols.
i am able ping database.
How can you do that in SQL?|||mine is MIXEDMODE.

this is obtained by setting parameter SECURITYMODE=SQL

i am sorry to tell u that i ping to database.

not database... it is server.

i am able to ping to server where i installed MSDE.

Originally posted by Satya
Review points listed in the knowledgebase article.

SQL Server does have only 2 modes - Windows only or mixed. Which on e is yours?

Don't know about this protocol in SQL, it should be named-pipes, TCP/ip or Multi-protocol. From Start--> programs --> goto MSSQLServer program group and select Server network utility and check for enabled protocols.

How can you do that in SQL?|||I'm probably being silly, but could you have installed SQL as a named server and tried to access it as a default (unnamed) server?

-PatP|||Check for any h/w issues on server installed by referring to event viewer log.

Monday, February 20, 2012

Microsoft SQL Server Management Studio Express

I am attempting to connect to a SQL Server 2005 database using a Visual
Studio.Net 2003 application.
When I use this connection string, I get a Keyword not supported: 'user
instance'. error.
<add key="SiteSqlServer" value="Data Source=.\SQLExpress;uid=sa;pwd=;User
Instance=True;AttachDBFilename=|DataDirectory|MyDB .mdf;Initial
Catalog=MyDB;" />
When I remove the "User Instance=True", I get a
Database 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDB.mdf'
already exists. Could not attach file '|DataDirectory|MyDB.mdf' as database
'MyDB'.
What kind of connection string do I use and why doesn't VS2003 recognize the
"User Instance=True"?
See if this helps:
http://msdn.microsoft.com/sql/defaul...xpuserinst.asp
Andrew J. Kelly SQL MVP
"Nick K" <nospam@.hotmail.com> wrote in message
news:eT0gKC7DGHA.1032@.TK2MSFTNGP11.phx.gbl...
>I am attempting to connect to a SQL Server 2005 database using a Visual
> Studio.Net 2003 application.
> When I use this connection string, I get a Keyword not supported: 'user
> instance'. error.
> <add key="SiteSqlServer" value="Data Source=.\SQLExpress;uid=sa;pwd=;User
> Instance=True;AttachDBFilename=|DataDirectory|MyDB .mdf;Initial
> Catalog=MyDB;" />
> When I remove the "User Instance=True", I get a
> Database 'c:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\MyDB.mdf'
> already exists. Could not attach file '|DataDirectory|MyDB.mdf' as
> database
> 'MyDB'.
> What kind of connection string do I use and why doesn't VS2003 recognize
> the
> "User Instance=True"?
>
|||I read the document. I don't see an explanation of the "User Instance=True",
keyword not recognized error I am seeing. Is this because my SQLClient is
the .Net Framework 1.1? I'm currently using VS 2003
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl...
> See if this helps:
>
http://msdn.microsoft.com/sql/defaul...xpuserinst.asp[vbcol=seagreen]
>
> --
> Andrew J. Kelly SQL MVP
>
> "Nick K" <nospam@.hotmail.com> wrote in message
> news:eT0gKC7DGHA.1032@.TK2MSFTNGP11.phx.gbl...
Source=.\SQLExpress;uid=sa;pwd=;User
>
|||I think you should re-read the document again and make sure you understand
exactly what a "User Instance" really is. If you really want to use a User
Instance you can not use SQL Logins as stated in the document. If you don't
really want a User instance you connect just like any other connection to
SQL Server but you do not need to attach the files. This assumes you have
already loaded SQL Server on that machine. I am not sure if when using a
User Instance if you need the 2.0 client or not but I suspect you might.
Andrew J. Kelly SQL MVP
"Nick K" <nospam@.hotmail.com> wrote in message
news:%23Tn$rO8DGHA.2708@.TK2MSFTNGP11.phx.gbl...
>I read the document. I don't see an explanation of the "User
>Instance=True",
> keyword not recognized error I am seeing. Is this because my SQLClient is
> the .Net Framework 1.1? I'm currently using VS 2003
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl...
> http://msdn.microsoft.com/sql/defaul...xpuserinst.asp
> Source=.\SQLExpress;uid=sa;pwd=;User
>
|||Hello Nick,
I'm afraid that you need VS2005/.net 2.0 and SqlClient native data provider
for SQL Server support is included.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Nick K" <nospam@.hotmail.com>
>References: <eT0gKC7DGHA.1032@.TK2MSFTNGP11.phx.gbl>
<#XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl>
>Subject: Re: Microsoft SQL Server Management Studio Express
>Date: Mon, 2 Jan 2006 10:38:47 -0700
>Lines: 44
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <#Tn$rO8DGHA.2708@.TK2MSFTNGP11.phx.gbl>
>Newsgroups:
microsoft.public.vsnet.general,microsoft.public.sq lserver.connect,microsoft.
public.sqlserver.mseq
>NNTP-Posting-Host: 70-59-19-126.hlrn.qwest.net 70.59.19.126
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP11.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.connect:46507
microsoft.public.sqlserver.mseq:7868 microsoft.public.vsnet.general:30200
>X-Tomcat-NG: microsoft.public.sqlserver.connect
>I read the document. I don't see an explanation of the "User
Instance=True",
>keyword not recognized error I am seeing. Is this because my SQLClient is
>the .Net Framework 1.1? I'm currently using VS 2003
>"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
>news:%23XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl...
>http://msdn.microsoft.com/sql/defaul...s/dnsse/html/s
qlexpuserinst.asp[vbcol=seagreen]
>Source=.\SQLExpress;uid=sa;pwd=;User
recognize
>
>

Microsoft SQL Server Management Studio Express

I am attempting to connect to a SQL Server 2005 database using a Visual
Studio.Net 2003 application.
When I use this connection string, I get a Keyword not supported: 'user
instance'. error.
<add key="SiteSqlServer" value="Data Source=.\SQLExpress;uid=sa;pwd=;User
Instance=True;AttachDBFilename=|DataDirectory|MyDB .mdf;Initial
Catalog=MyDB;" />
When I remove the "User Instance=True", I get a
Database 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDB.mdf'
already exists. Could not attach file '|DataDirectory|MyDB.mdf' as database
'MyDB'.
What kind of connection string do I use and why doesn't VS2003 recognize the
"User Instance=True"?
See if this helps:
http://msdn.microsoft.com/sql/defaul...xpuserinst.asp
Andrew J. Kelly SQL MVP
"Nick K" <nospam@.hotmail.com> wrote in message
news:eT0gKC7DGHA.1032@.TK2MSFTNGP11.phx.gbl...
>I am attempting to connect to a SQL Server 2005 database using a Visual
> Studio.Net 2003 application.
> When I use this connection string, I get a Keyword not supported: 'user
> instance'. error.
> <add key="SiteSqlServer" value="Data Source=.\SQLExpress;uid=sa;pwd=;User
> Instance=True;AttachDBFilename=|DataDirectory|MyDB .mdf;Initial
> Catalog=MyDB;" />
> When I remove the "User Instance=True", I get a
> Database 'c:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\MyDB.mdf'
> already exists. Could not attach file '|DataDirectory|MyDB.mdf' as
> database
> 'MyDB'.
> What kind of connection string do I use and why doesn't VS2003 recognize
> the
> "User Instance=True"?
>
|||I read the document. I don't see an explanation of the "User Instance=True",
keyword not recognized error I am seeing. Is this because my SQLClient is
the .Net Framework 1.1? I'm currently using VS 2003
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl...
> See if this helps:
>
http://msdn.microsoft.com/sql/defaul...xpuserinst.asp[vbcol=seagreen]
>
> --
> Andrew J. Kelly SQL MVP
>
> "Nick K" <nospam@.hotmail.com> wrote in message
> news:eT0gKC7DGHA.1032@.TK2MSFTNGP11.phx.gbl...
Source=.\SQLExpress;uid=sa;pwd=;User
>
|||I think you should re-read the document again and make sure you understand
exactly what a "User Instance" really is. If you really want to use a User
Instance you can not use SQL Logins as stated in the document. If you don't
really want a User instance you connect just like any other connection to
SQL Server but you do not need to attach the files. This assumes you have
already loaded SQL Server on that machine. I am not sure if when using a
User Instance if you need the 2.0 client or not but I suspect you might.
Andrew J. Kelly SQL MVP
"Nick K" <nospam@.hotmail.com> wrote in message
news:%23Tn$rO8DGHA.2708@.TK2MSFTNGP11.phx.gbl...
>I read the document. I don't see an explanation of the "User
>Instance=True",
> keyword not recognized error I am seeing. Is this because my SQLClient is
> the .Net Framework 1.1? I'm currently using VS 2003
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl...
> http://msdn.microsoft.com/sql/defaul...xpuserinst.asp
> Source=.\SQLExpress;uid=sa;pwd=;User
>