Thursday, March 29, 2012
Do Queries Support Regular Expressions?
contained the term 'Business' for example? Would Regular Expressions be
supported in this context? Your comments regarding performance of a category
schema such as this?
// Example
PrivateSector_Business_Services
<%= Clinton GallagherClinton,
You could use the LIKE operator with the % wildcard character as:
WHERE COLUMN LIKE '%Business%'
Optionally you could use a Full-Text index as well.
HTH
Jerry
"clintonG" < csgallagher@.REMOVETHISTEXTmetromilwaukee
.com> wrote in message
news:OOuBDiczFHA.1192@.TK2MSFTNGP10.phx.gbl...
> If I had the following string in a table how could I find all records that
> contained the term 'Business' for example? Would Regular Expressions be
> supported in this context? Your comments regarding performance of a
> category schema such as this?
> // Example
> PrivateSector_Business_Services
> <%= Clinton Gallagher
>
>
>
>|||Thank you Jerry. That was simple :-)
<%= Clinton Gallagher
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:OZqoPlczFHA.2884@.TK2MSFTNGP09.phx.gbl...
> Clinton,
> You could use the LIKE operator with the % wildcard character as:
> WHERE COLUMN LIKE '%Business%'
> Optionally you could use a Full-Text index as well.
> HTH
> Jerry
> "clintonG" < csgallagher@.REMOVETHISTEXTmetromilwaukee
.com> wrote in message
> news:OOuBDiczFHA.1192@.TK2MSFTNGP10.phx.gbl...
>|||For what it's worth, you can make real regular expression query searches via
calls to external COM libraries.
http://blogs.msdn.com/khen1234/arch.../11/416392.aspx
However, if using the native LIKE operator satisfies your requirement, then
use that instead.
"clintonG" < csgallagher@.REMOVETHISTEXTmetromilwaukee
.com> wrote in message
news:OOuBDiczFHA.1192@.TK2MSFTNGP10.phx.gbl...
> If I had the following string in a table how could I find all records that
> contained the term 'Business' for example? Would Regular Expressions be
> supported in this context? Your comments regarding performance of a
> category schema such as this?
> // Example
> PrivateSector_Business_Services
> <%= Clinton Gallagher
>
>
>
>
Do not display the result of my long text string, approx about 400 characters
SELECT '510', PRODCLASSID
, '1', COMPONENTID,'ENG'+SPACE(2),'#'+SPACE(254),'#'+SPAC E(254),'#'+SPACE(254),'#'+SPACE(99),externalid,
'Desc1' = CASE
WHEN SUBSTRING(externalid,1,2) = 'MF'
THEN 'Full machine warranty : parts, labour, mileage and others covered at warranty rates applicable at the time of repair. '
WHEN SUBSTRING(externalid,1,2) = 'MP'
THEN 'Full machine warranty, parts only : parts covered at warranty rates applicable at the time of repair. '
WHEN SUBSTRING(externalid,1,2) = 'PF'
THEN 'Power line warranty : parts, labour, mileage and others covered at warranty rates applicable at the time of repair. '
WHEN SUBSTRING(externalid,1,2) = 'PP'
THEN 'Power line warranty, parts only : parts are covered at warranty rates applicable at the time of repair. '
END
+
CASE
WHEN SUBSTRING(externalid,LEN(externalid)- 3,4) = '2018'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 18 month or 2000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '3024'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 24 month or 3000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '4030'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 30 month or 4000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '5036'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 36 month or 5000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '6042'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 42 month or 6000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '8054'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 54 month or 8000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '1074'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 74 month or 10000 HRS, whichever comes first. '
END
+ 'Flexible warranty is handled according to the procedures described in ESPPM 3-10.'
+
CASE
WHEN prodclassid IN ('P1','P11','P8','P9')
THEN ' (mileage limited to 300 km)'
WHEN prodclassid IN ('P7')
THEN ' (mileage limited to 200 km)'
ELSE NULL
END
+
SPACE(5000 - LEN('Desc1'))
......If you are using the MS Query Analyzer from the SQL 2000 Client Tools, you can set the maximum column length. Select Tools | Options | Results and the length control is near the middle of the sheet.
-PatPsql
Sunday, March 25, 2012
Do I need to change connection string if I upgrage SQL server from 2000 to 2005?
Wednesday, March 21, 2012
DNS-less connection w/ no prompt VB
I can connect using the below connection string ...
Driver={SQL
Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSWORD;DATABASE=myDATABASE;
WHEN I USE...
Set dbsODBC = OpenDatabase("",False, False, strConnect)
BUT IF I try to disable the prompt using...
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
AND
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
strConnect)
my connection either does not connect or it displays the prompt. I
think the problem has something to do with me not using a DSN, but I
thought I should be able to connect without one. PLEASE HELP!
What am I doing wrong, and why would this be happening?
THANK YOU!!I don't understand your question. Open Database is a method of the Jet
database engine (DAO) used with Microsoft Access, not SQL Server. The
connection string you are using is not the correct syntax for the DAO
OpenDatabase method. If you're trying to open an Access database that has a
table in it that is linked to SQL Server, then the linked table has to have
the DSN-less connection string in it's Connect property and you need to use
the syntax for DAO as the parameter to the OpenDatabase function. But, I'm
having a hard time figuring out why you would want to do this? To connect to
a SQL Server DB from VB you should be using ADO (ActiveX Data Objects). The
connection string you are using *is* the correct syntax for the ADO
Connection object's Open method. No need for Jet or Access at this point.
<stoppal@.hotmail.com> wrote in message
news:1129838783.819043.87440@.o13g2000cwo.googlegroups.com...
> I have a problem trying to link my access table using VB
>
> I can connect using the below connection string ...
>
> Driver={SQL
> Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSWORD;DATABASE=myDATABASE;
>
> WHEN I USE...
>
> Set dbsODBC = OpenDatabase("",False, False, strConnect)
>
> BUT IF I try to disable the prompt using...
>
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
> AND
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
> strConnect)
>
> my connection either does not connect or it displays the prompt. I
> think the problem has something to do with me not using a DSN, but I
> thought I should be able to connect without one. PLEASE HELP!
>
> What am I doing wrong, and why would this be happening?
>
> THANK YOU!!
>|||thank you for the recommendation I'll try it at work tommorrow.
I'll tell you if it works friday, morning|||GOT IT WORKS, THANK YOU!!!!!!!!!!!!!!!!
DNS-less connection w/ no prompt VB
I can connect using the below connection string ...
Driver={SQL
Server};SERVER=MYSERVER;UID=MYUSERNAME;P
WD=myPASSWORD;DATABASE=myDATABASE;
WHEN I USE...
Set dbsODBC = OpenDatabase("",False, False, strConnect)
BUT IF I try to disable the prompt using...
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
AND
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
strConnect)
my connection either does not connect or it displays the prompt. I
think the problem has something to do with me not using a DSN, but I
thought I should be able to connect without one. PLEASE HELP!
What am I doing wrong, and why would this be happening?
THANK YOU!!I don't understand your question. Open Database is a method of the Jet
database engine (DAO) used with Microsoft Access, not SQL Server. The
connection string you are using is not the correct syntax for the DAO
OpenDatabase method. If you're trying to open an Access database that has a
table in it that is linked to SQL Server, then the linked table has to have
the DSN-less connection string in it's Connect property and you need to use
the syntax for DAO as the parameter to the OpenDatabase function. But, I'm
having a hard time figuring out why you would want to do this? To connect to
a SQL Server DB from VB you should be using ADO (ActiveX Data Objects). The
connection string you are using *is* the correct syntax for the ADO
Connection object's Open method. No need for Jet or Access at this point.
<stoppal@.hotmail.com> wrote in message
news:1129838783.819043.87440@.o13g2000cwo.googlegroups.com...
> I have a problem trying to link my access table using VB
>
> I can connect using the below connection string ...
>
> Driver={SQL
> Server};SERVER=MYSERVER;UID=MYUSERNAME;P
WD=myPASSWORD;DATABASE=myDATABASE;
>
> WHEN I USE...
>
> Set dbsODBC = OpenDatabase("",False, False, strConnect)
>
> BUT IF I try to disable the prompt using...
>
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
> AND
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
> strConnect)
>
> my connection either does not connect or it displays the prompt. I
> think the problem has something to do with me not using a DSN, but I
> thought I should be able to connect without one. PLEASE HELP!
>
> What am I doing wrong, and why would this be happening?
>
> THANK YOU!!
>|||thank you for the recommendation I'll try it at work tommorrow.
I'll tell you if it works friday, morning|||GOT IT WORKS, THANK YOU!!!!!!!!!!!!!!!!
DNS-less connection w/ no prompt VB
I can connect using the below connection string ...
Driver={SQL
Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSW ORD;DATABASE=myDATABASE;
WHEN I USE...
Set dbsODBC = OpenDatabase("",False, False, strConnect)
BUT IF I try to disable the prompt using...
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
AND
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
strConnect)
my connection either does not connect or it displays the prompt. I
think the problem has something to do with me not using a DSN, but I
thought I should be able to connect without one. PLEASE HELP!
What am I doing wrong, and why would this be happening?
THANK YOU!!
I don't understand your question. Open Database is a method of the Jet
database engine (DAO) used with Microsoft Access, not SQL Server. The
connection string you are using is not the correct syntax for the DAO
OpenDatabase method. If you're trying to open an Access database that has a
table in it that is linked to SQL Server, then the linked table has to have
the DSN-less connection string in it's Connect property and you need to use
the syntax for DAO as the parameter to the OpenDatabase function. But, I'm
having a hard time figuring out why you would want to do this? To connect to
a SQL Server DB from VB you should be using ADO (ActiveX Data Objects). The
connection string you are using *is* the correct syntax for the ADO
Connection object's Open method. No need for Jet or Access at this point.
<stoppal@.hotmail.com> wrote in message
news:1129838783.819043.87440@.o13g2000cwo.googlegro ups.com...
> I have a problem trying to link my access table using VB
>
> I can connect using the below connection string ...
>
> Driver={SQL
> Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSW ORD;DATABASE=myDATABASE;
>
> WHEN I USE...
>
> Set dbsODBC = OpenDatabase("",False, False, strConnect)
>
> BUT IF I try to disable the prompt using...
>
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
> AND
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
> strConnect)
>
> my connection either does not connect or it displays the prompt. I
> think the problem has something to do with me not using a DSN, but I
> thought I should be able to connect without one. PLEASE HELP!
>
> What am I doing wrong, and why would this be happening?
>
> THANK YOU!!
>
|||thank you for the recommendation I'll try it at work tommorrow.
I'll tell you if it works friday, morning
|||GOT IT WORKS, THANK YOU!!!!!!!!!!!!!!!!
Sunday, March 11, 2012
dll in c# sql 2005
I wrote a class in C# with one method that returns a string. I built the dll and deployed it into sql 2005 and everything works just fine.
I am now in a situation where I need to use this function in SQL 2000. Is there any way that I can use the existing dll and create a sql 2000 function, and if so how do I go about doing this?
Here is the c# code from the deployed dll.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Text.RegularExpressions;
public partial class GECBI
{
[Microsoft.SqlServer.Server.SqlFunction(IsDeterministic = true, IsPrecise = true)]
public static string RegExMatch(string pattern, string matchString)
{
Regex r1 = new Regex(pattern);
if (r1.Match(matchString.TrimEnd(null)).Success)
{
Regex testReg = new Regex(pattern);
Match regMatch = testReg.Match(matchString);
string runnumber = regMatch.ToString();
return runnumber;
}
else
{
return null;
}
}
};
Accesing CLR Function is only possible in SQL2k5. Wrapping the .NET object in a COM object or calling the function on a SQL2k5 Server would be very slow during execution time.HTH, JEns K. Suessmeyer.
http://www.sqlserver2005.de|||So what would be an alternative for me to achieve the above? Can someone give me an example of how to create the above function in something that I can use with sql 2k please?|||There is actually no alternativ for that. have a look in the internet, there have been some samples implemented to mimic the functionality.
http://www.google.de/search?hl=de&q=regular+expressions+sql+server+2000&meta= http://www.codeproject.com/managedcpp/xpregex.asp
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
Wednesday, March 7, 2012
distributor_admin
In my connection string as below , i have specified to use the user "sa"
but i am not sure why the error msg says login fail for distributor_admin
the server that i am connecting to is set up as a distirbutor on a local
publisher
strConn = "Provider=SQLOLEDB;Data Source=AAA;InititalCatalog
=master;uid=sa;pwd=XXXX"
appreciate any advice
tks & rdgs
Hi,
is there such a so called default password for this distributor_admin user ?
i can see that in the remote login , the sa is being mapped to the
distributor_admin when i tried to change it , it can be changed but once i
come it again it's still being mapped to distributor_admin
appreciate if someone could help
tks & rdgs
"maxzsim" wrote:
> Hi ,
> In my connection string as below , i have specified to use the user "sa"
> but i am not sure why the error msg says login fail for distributor_admin
> the server that i am connecting to is set up as a distirbutor on a local
> publisher
> strConn = "Provider=SQLOLEDB;Data Source=AAA;InititalCatalog
> =master;uid=sa;pwd=XXXX"
> appreciate any advice
> tks & rdgs
distributor_admin
In my connection string as below , i have specified to use the user "sa"
but i am not sure why the error msg says login fail for distributor_admin
the server that i am connecting to is set up as a distirbutor on a local
publisher
strConn = "Provider=SQLOLEDB;Data Source=AAA;InititalCatalog
=master;uid=sa;pwd=XXXX"
appreciate any advice
tks & rdgsHi,
is there such a so called default password for this distributor_admin user ?
i can see that in the remote login , the sa is being mapped to the
distributor_admin when i tried to change it , it can be changed but once i
come it again it's still being mapped to distributor_admin
appreciate if someone could help
tks & rdgs
"maxzsim" wrote:
> Hi ,
> In my connection string as below , i have specified to use the user "sa"
> but i am not sure why the error msg says login fail for distributor_admin
> the server that i am connecting to is set up as a distirbutor on a local
> publisher
> strConn = "Provider=SQLOLEDB;Data Source=AAA;InititalCatalog
> =master;uid=sa;pwd=XXXX"
> appreciate any advice
> tks & rdgs
distributor_admin
In my connection string as below , i have specified to use the user "sa"
but i am not sure why the error msg says login fail for distributor_admin
the server that i am connecting to is set up as a distirbutor on a local
publisher
strConn = "Provider=SQLOLEDB;Data Source=AAA;InititalCatalog
=master;uid=sa;pwd=XXXX"
appreciate any advice
tks & rdgsHi,
is there such a so called default password for this distributor_admin user ?
i can see that in the remote login , the sa is being mapped to the
distributor_admin when i tried to change it , it can be changed but once i
come it again it's still being mapped to distributor_admin
appreciate if someone could help
tks & rdgs
"maxzsim" wrote:
> Hi ,
> In my connection string as below , i have specified to use the user "sa"
> but i am not sure why the error msg says login fail for distributor_admin
> the server that i am connecting to is set up as a distirbutor on a local
> publisher
> strConn = "Provider=SQLOLEDB;Data Source=AAA;InititalCatalog
> =master;uid=sa;pwd=XXXX"
> appreciate any advice
> tks & rdgs