Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Tuesday, March 27, 2012

Access database with php access

Hello all,

forgive me if this isn't the right forum for this isue

I'm using the following php code:

$db = realpath("database/userdatabase.mdb") or die('<b>Connectie met database mislukt</b>');

$conn = new COM("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

$conn->Execute("INSERT INTO TblNews(Title, Nieuws, Date, Author) VALUES ('Testing', 'tekst', '16Oktober2006', 'Ikke')");

$conn->Execute("INSERT INTO TblNews VALUES (20,'Testing', 'tekst', '16 Oktober 2006', 'Ikke')");


The 2nd insert command works perfectly but the first gives an error all the time!
The table has a NewsID with auto_increment on..

The error:
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.' in d:\www\tiedtzat.nl\www\nieuw\testdb.php:19 Stack trace: #0 d:\www\tiedtzat.nl\www\nieuw\testdb.php(19): com->Execute('INSERT INTO Tbl...') #1 {main} thrown in site.com\testdb.php on line 19

Thanks for the help in advance! :)

Hi,

if the driver does not bring back any detailed information you should try to execute the query within access to see a more detailed error information. As from your queries ir could be taht your second queries fills a not nullable field which is not filled within the first query. Which columns are you filling in the second query that you don′t dill in the first one ?

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Hey,

I found the problem!
I was using Date as one of the fields in the table which access doesn't seem to accept :)

Thanks for your help!

|||

Hi TrojanH: (sorry for my English I only speak Spanish) I'm traying too use PHP with Ms Accesss database and ADODB.Connection but have not found a manual about ADO and PHP. and I'not able mannage the recordset , I need know how do a seek, like mysql_data_seek or know the record number etc,

if it's possible can you tellme where to find info?

Thanks.

|||

Hello Gabriel,

As you might have noticed, information about adodb.connection is very hard to find on the Internet so I don't have much information...

What I use in php is this:

$db = realpath("database/db.mdb") or die('<b>Connection failed</b>');

$conn = new COM("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

$rs = $conn->Execute("Select blabla... yadi yadi");

while(!$rs->EOF){

$blabla = $rs->Fields("blabla")->value;

$rs->MoveNext(); // Dont forget this!!!

}

good luck!|||

TrojanH:

that is the only way I know to view-manage the base. but I need more than this,

Thank.

|||

Gabriel wrote:

TrojanH:

that is the only way I know to view-manage the base. but I need more than this,

Thank.

The Execute performs all actions including update, delete etc...

I don't know what you need to know exactly but that probably goes beyond my knowledge about access databases Sad

|||

Hi again:

Actualy I know how to do SELECT, INSERT, UPDATE & DELETE.

But I need functions link : "mysql_data_seek()", "mysql_num_rows()", or " Select * from tabla LIMIT $ini, $reg "

This kind of funtions that allow to manage data.

|||

Gabriel wrote:

"mysql_num_rows()"

You could try the standard count(*) function in sql

Gabriel wrote:

" Select * from tabla LIMIT $ini, $reg "

As far as I know, there is no 'LIMIT' in sql (only mysql) and sql will only accept stuff like "Select TOP 10 * FROM..."

Sorry, cant help you any further with this... I hope this works for you Smile

Access database with php access

Hello all,

forgive me if this isn't the right forum for this isue

I'm using the following php code:

$db = realpath("database/userdatabase.mdb") or die('<b>Connectie met database mislukt</b>');

$conn = new COM("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

$conn->Execute("INSERT INTO TblNews(Title, Nieuws, Date, Author) VALUES ('Testing', 'tekst', '16Oktober2006', 'Ikke')");

$conn->Execute("INSERT INTO TblNews VALUES (20,'Testing', 'tekst', '16 Oktober 2006', 'Ikke')");


The 2nd insert command works perfectly but the first gives an error all the time!
The table has a NewsID with auto_increment on..

The error:
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.' in d:\www\tiedtzat.nl\www\nieuw\testdb.php:19 Stack trace: #0 d:\www\tiedtzat.nl\www\nieuw\testdb.php(19): com->Execute('INSERT INTO Tbl...') #1 {main} thrown in site.com\testdb.php on line 19

Thanks for the help in advance! :)

Hi,

if the driver does not bring back any detailed information you should try to execute the query within access to see a more detailed error information. As from your queries ir could be taht your second queries fills a not nullable field which is not filled within the first query. Which columns are you filling in the second query that you don′t dill in the first one ?

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Hey,

I found the problem!
I was using Date as one of the fields in the table which access doesn't seem to accept :)

Thanks for your help!

|||

Hi TrojanH: (sorry for my English I only speak Spanish) I'm traying too use PHP with Ms Accesss database and ADODB.Connection but have not found a manual about ADO and PHP. and I'not able mannage the recordset , I need know how do a seek, like mysql_data_seek or know the record number etc,

if it's possible can you tellme where to find info?

Thanks.

|||

Hello Gabriel,

As you might have noticed, information about adodb.connection is very hard to find on the Internet so I don't have much information...

What I use in php is this:

$db = realpath("database/db.mdb") or die('<b>Connection failed</b>');

$conn = new COM("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

$rs = $conn->Execute("Select blabla... yadi yadi");

while(!$rs->EOF){

$blabla = $rs->Fields("blabla")->value;

$rs->MoveNext(); // Dont forget this!!!

}

good luck!|||

TrojanH:

that is the only way I know to view-manage the base. but I need more than this,

Thank.

|||

Gabriel wrote:

TrojanH:

that is the only way I know to view-manage the base. but I need more than this,

Thank.

The Execute performs all actions including update, delete etc...

I don't know what you need to know exactly but that probably goes beyond my knowledge about access databases Sad

|||

Hi again:

Actualy I know how to do SELECT, INSERT, UPDATE & DELETE.

But I need functions link : "mysql_data_seek()", "mysql_num_rows()", or " Select * from tabla LIMIT $ini, $reg "

This kind of funtions that allow to manage data.

|||

Gabriel wrote:

"mysql_num_rows()"

You could try the standard count(*) function in sql

Gabriel wrote:

" Select * from tabla LIMIT $ini, $reg "

As far as I know, there is no 'LIMIT' in sql (only mysql) and sql will only accept stuff like "Select TOP 10 * FROM..."

Sorry, cant help you any further with this... I hope this works for you Smile

Access database with php access

Hello all,

forgive me if this isn't the right forum for this isue

I'm using the following php code:

$db = realpath("database/userdatabase.mdb") or die('<b>Connectie met database mislukt</b>');

$conn = new COM("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

$conn->Execute("INSERT INTO TblNews(Title, Nieuws, Date, Author) VALUES ('Testing', 'tekst', '16Oktober2006', 'Ikke')");

$conn->Execute("INSERT INTO TblNews VALUES (20,'Testing', 'tekst', '16 Oktober 2006', 'Ikke')");


The 2nd insert command works perfectly but the first gives an error all the time!
The table has a NewsID with auto_increment on..

The error:
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.' in d:\www\tiedtzat.nl\www\nieuw\testdb.php:19 Stack trace: #0 d:\www\tiedtzat.nl\www\nieuw\testdb.php(19): com->Execute('INSERT INTO Tbl...') #1 {main} thrown in site.com\testdb.php on line 19

Thanks for the help in advance! :)

Hi,

if the driver does not bring back any detailed information you should try to execute the query within access to see a more detailed error information. As from your queries ir could be taht your second queries fills a not nullable field which is not filled within the first query. Which columns are you filling in the second query that you don′t dill in the first one ?

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Hey,

I found the problem!
I was using Date as one of the fields in the table which access doesn't seem to accept :)

Thanks for your help!

|||

Hi TrojanH: (sorry for my English I only speak Spanish) I'm traying too use PHP with Ms Accesss database and ADODB.Connection but have not found a manual about ADO and PHP. and I'not able mannage the recordset , I need know how do a seek, like mysql_data_seek or know the record number etc,

if it's possible can you tellme where to find info?

Thanks.

|||

Hello Gabriel,

As you might have noticed, information about adodb.connection is very hard to find on the Internet so I don't have much information...

What I use in php is this:

$db = realpath("database/db.mdb") or die('<b>Connection failed</b>');

$conn = new COM("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

$rs = $conn->Execute("Select blabla... yadi yadi");

while(!$rs->EOF){

$blabla = $rs->Fields("blabla")->value;

$rs->MoveNext(); // Dont forget this!!!

}

good luck!|||

TrojanH:

that is the only way I know to view-manage the base. but I need more than this,

Thank.

|||

Gabriel wrote:

TrojanH:

that is the only way I know to view-manage the base. but I need more than this,

Thank.

The Execute performs all actions including update, delete etc...

I don't know what you need to know exactly but that probably goes beyond my knowledge about access databases Sad

|||

Hi again:

Actualy I know how to do SELECT, INSERT, UPDATE & DELETE.

But I need functions link : "mysql_data_seek()", "mysql_num_rows()", or " Select * from tabla LIMIT $ini, $reg "

This kind of funtions that allow to manage data.

|||

Gabriel wrote:

"mysql_num_rows()"

You could try the standard count(*) function in sql

Gabriel wrote:

" Select * from tabla LIMIT $ini, $reg "

As far as I know, there is no 'LIMIT' in sql (only mysql) and sql will only accept stuff like "Select TOP 10 * FROM..."

Sorry, cant help you any further with this... I hope this works for you Smile

Access Database Datatypes, ADOX and VS2005 Question

I'm using ADOX 2.8 for table creation: The following is an example of a column defintion:

If CreateNewTable Then CreateNewTable = a.CreateColumn("ReferenceCount", ADOX.DataTypeEnum.adInteger)

If CreateNewTable Then CreateNewTable = a.CreateColumn("Document", ADOX.DataTypeEnum.adLongVarBinary) 'Oleobject

If CreateNewTable Then CreateNewTable = a.CreateColumn("EntityID", ADOX.DataTypeEnum.adWChar, 18) 'text

Where CreateColumn looks like this:

Public Function CreateColumn(ByVal ColumnName As String, ByVal Datatype As ADOX.DataTypeEnum, Optional ByVal Size As Integer = 0) As Boolean

'ADOX.CreateColumn- Called by Common.CreateNewTable

'CreateColumn creates a column described in the Table object so it assumes it is set.

'One method of setting it is to call Select Table after opening the database

If Not Me.ConnectionIsOpen Then

MsgBox("CreateColumn - Failed to Create Column : " _

& ColumnName, MsgBoxStyle.Exclamation, cNoConn)

Return False

End If

Dim col As New ADOX.Column

col.Name = ColumnName

Try

col.Type = Datatype

Catch e As Exception

MsgBox("CreateColumb - Failed to Create Column : " _

& ColumnName, MsgBoxStyle.Exclamation, e.Message)

col = Nothing

Return False

End Try

If Size <> 0 Then col.DefinedSize = Size

Try

Table.Columns.Append(ColumnName, Datatype)

Catch e As Exception

If Err.Number() <> 0 Then

MsgBox(Err.Source & "-->" & Err.Description, , "Error")

End If

MsgBox("CreateColumb - Failed to Append Column : " _

& ColumnName, MsgBoxStyle.Exclamation, e.Message)

Return False

End Try

col = Nothing

Return True

End Function

in CreateColumn("EntityID", ADOX.DataTypeEnum.adWChar, 18)

the 18 specifies the field width in the database. Yet no matter whether I use adWChar or

adVarWChar, Access always shows the field size to be 255.

Does anyone know why or how to fix that?

I can see that you created col variable, and assigned values to the fields of it. But, unless I'm missing something, I do not see how it is used in Table.Columns.Append call.

I guess that you should either use col instead of ColumnName, or add Size as a third parameter, and do not use col at all.

Thursday, March 22, 2012

Access accessing SQL {}

Im using Access to access a SQL database. For one of the queries i see the following under column:

{ fn month(dbo.TableName.Date) }

Ive never used this structure before but im confused to what it is? Can anyone explain please?

Thanks

The curly braces and 'fn' server to denote a OBDC level function.

The T-SQL equilivent would be:

month( YourDateColumn )

|||

Hello

Thanks for that. Could you explain a bit more on that please? As far as im concerned i didnt think there would be an ODBC link as it was connecting straight to a SQL database (checking ODBC theres no link to a SQL database either). Maybe an example if you can on what this user could have been trying to achieve would be great?

Thanks

Monday, March 19, 2012

Access <- > SQL Server

Hello!

We have following situation;
network with 100 users, aplication developed in Access, user DB
deployed on SQL Server.

Is it better to create query inside aplication (with code) and then pass
it to SQL Server for execution or is it better to have all these queries
saved like stored procedures and then called from aplication?

Witch queries run faster?

Thank's!

P.S. I know that my english isn't perfect:(!!!!!On Sun, 15 Feb 2004 21:30:11 +0100 in comp.databases.ms-access,
"Jegger" <dzugaj@.net4u.hr> wrote:

>Hello!
> We have following situation;
> network with 100 users, aplication developed in Access, user DB
>deployed on SQL Server.
> Is it better to create query inside aplication (with code) and then pass
>it to SQL Server for execution or is it better to have all these queries
>saved like stored procedures and then called from aplication?
> Witch queries run faster?

Stored procedures are compiled with the execution plan so run faster
than dynamic SQL.

--
A)bort, R)etry, I)nfluence with large hammer.|||On Sun, 15 Feb 2004 21:30:11 +0100, "Jegger" <dzugaj@.net4u.hr> wrote:

>Hello!
> We have following situation;
> network with 100 users, aplication developed in Access, user DB
>deployed on SQL Server.
> Is it better to create query inside aplication (with code) and then pass
>it to SQL Server for execution or is it better to have all these queries
>saved like stored procedures and then called from aplication?
> Witch queries run faster?
> Thank's!
>P.S. I know that my english isn't perfect:(!!!!!

Since you say this is an application developed in Access, and there are,
apparently, no other applications sharing the back-end, my recommendation is
to implement all the queries in Access except those that you can't make run
optimally that way by simply modifying the query's approach (chaning
subqueries to outer joins, etc.). Most queries of linked tables on SQL Server
will run well as Access queries.

The reason for keeping the queries in Access as much as possible is that it
makes the particular choice of server easier to change. It would be
relatively (though not totally) trivial, for instance, to switch to a
PostgreSQL or Oracle back-end.

There is actually very little speed penalty, in most cases, for executing
Access queries against linked, ODBC tables because Access can generally
convert these into prepared statements that actually act quite a bit like
stored procedures in that they are compiled once by the server when they are
first used, then reused when the same query is executed again. SQL Server is
also clever enough to reuse the same query plan when additional statements are
prepared with identical definitions.|||I make it a rule to: (well, rules)

1) Create parameterized stored procedures whenever possible, which usually mean
every read-only situation. (If you're using ADPs, however, MS has done a heluva
job making param SPs updatable.)

2) Create Pass-through queries for any must-have dynamic sql (again,
read-only). Also, PT queries must be used to call those SQL Server SPs!

3) ONLY use JET (Access) queries for those siutations that REQUIRE it, like
updatable BOUND data sources, LinkChild/Master, consumers of VBA custom
functions, etc. (And strive to make your VBA functions into processes that use
SQL Server if you can)

It really boils down to this: Don't use JET unless you ABSOLUTELY MUST. I
haven't gone as far as some JET-haters that use UNBOUND forms w/
insert/update/delete classes, but I'm getting there...

I love Access as a front-end building tool, and a reporting tool. But I can
live without JET.

All of me recent Access/SQL development has been ADPs...no JET! YAYYYY!|||On 15 Feb 2004 23:41:03 GMT, dcmfan@.aol.comSPNOAM (DCM Fan) wrote:

>I make it a rule to: (well, rules)
>1) Create parameterized stored procedures whenever possible, which usually mean
>every read-only situation. (If you're using ADPs, however, MS has done a heluva
>job making param SPs updatable.)
>2) Create Pass-through queries for any must-have dynamic sql (again,
>read-only). Also, PT queries must be used to call those SQL Server SPs!
>3) ONLY use JET (Access) queries for those siutations that REQUIRE it, like
>updatable BOUND data sources, LinkChild/Master, consumers of VBA custom
>functions, etc. (And strive to make your VBA functions into processes that use
>SQL Server if you can)
>It really boils down to this: Don't use JET unless you ABSOLUTELY MUST. I
>haven't gone as far as some JET-haters that use UNBOUND forms w/
>insert/update/delete classes, but I'm getting there...
>I love Access as a front-end building tool, and a reporting tool. But I can
>live without JET.
>All of me recent Access/SQL development has been ADPs...no JET! YAYYYY!

I respect yor opinion, but I disagree. There are cases in which I do agree,
and these are when you will have multiple front-ends to the same data, but
when SQL Server is just the data store for an Access application, the
performance benefit to implenmenting everything server-side is more than
overshadowed by the increased complexity of the front-end, and the loss of
independence from a particular server back-end.

I do favor implementing server-side views and stored procedures as an
optimization when required, but only after a performance problem has been
identified, and it doesn't respond to more minor rearrangments of the queries.

Regarding the use of ADPs fopr client-server apps, I guess that worked for
you, but after I successfully implemented several client-server apps with DAO
and MDBs, I worked on one monster of a project with ADPs, and found it an
ecercise in terrible frustration. Error message handling doesn't work right,
Access is so touchy about the actual implementations of things on the back-end
that many techniques of great use from the server perspective are not usable,
the updatability rules change with every new release of MDAC, so that I've had
to adopt a practice of never trying to bind a form to a query on a join
because I can't trust it (I use hidden combo boxes for FK lookups - how's that
for efficiency!), etc. Frankly, I would never use ADPs again for anything
other than prototypig. I'm at least 5 times more productive using MDBs and
DAO. Of course, if I was using something other than Access as a front-end, I
would nearly always us ADO.

Clearly, your experience differs, but to me ADPs are simply far too unstable
for production systems, and I don't see that they provide any performance
boost, what with having to keep asking the server for schema information
instead of caching it locally in links, constantly digging around behind
procedures and views to update individual tables. You have to jumpt through
several hoops to force Access to respect your intended security and
abstractions with views and procedures, etc. I spend most of my time trying
to get the thing to do what I say instead of guessing what it'll do when it
tries to thnk for me and do what it "knows" I must want.|||Steve, we've been through all this before (pro/con of ADP) in the Access
forums.

Even if everything you say is true about ADPs, and the "common knowledge"
becomes "don't use ADPs, " I still stand by my mantra of "minimize use of JET
if at all possible."

I've never had corruption in 8 years of SQL Server development (It has happened
to others.) I have JET corruption at least once every 6 months. Granted, most
of the time it's caused by faulty hardware, but it scares me that JET is so
"nimble" that way.

Also, I don't know where you get your information on JET query performance, but
in NO WAY is it EVER equal to pass-through performance, except on the smallest
of SELECTS.

I can't begin to tell you how many times Access has either locked up, or I've
gotten impatient at the wait of a mutli-table query designed in the QBE, but
when run right from Query Analyzer returns records in less than 1 second.

Everyone of my combo boxes use Pass-through SELECTS. The performance increase
over JET selects REQUIRES IT, especially when connecting over the internet.
(one-to-one NAT)

Don't get me wrong...I take FULL ADVANTAGE of JET/DAO-based front ends (local
tables, specs, QBE), and I may even come up with an absolute must someday. I
even prefer DAO over ADO, but that's only because I KNOW that I'm more familiar
with it!

My bottom line is this: I'll listen to criticism of ADPs any day (although my
recent ADP projects have been successful, I have lots more exeperince with
MDB), but I can't take it when Access-lovers (I'm one) actually say with a
straight face that JET can perform in any way "as good as" SQL Server views,
SPs, or dynamic SQL.

Just the fact that an extra layer is involved ought to be enough proof...|||
On 16 Feb 2004 05:41:10 GMT, dcmfan@.aol.comSPNOAM (DCM Fan) wrote:

>Steve, we've been through all this before (pro/con of ADP) in the Access
>forums.
>Even if everything you say is true about ADPs, and the "common knowledge"
>becomes "don't use ADPs, " I still stand by my mantra of "minimize use of JET
>if at all possible."
>I've never had corruption in 8 years of SQL Server development (It has happened
>to others.) I have JET corruption at least once every 6 months. Granted, most
>of the time it's caused by faulty hardware, but it scares me that JET is so
>"nimble" that way.

I've had Access corruption, too, but the only times I've had data corruption
were when the back-end was an MDB. That has nothing to do with whether
queries are stored as Access objects or server-side objects when the data is
on the SQL Server.

>Also, I don't know where you get your information on JET query performance, but
>in NO WAY is it EVER equal to pass-through performance, except on the smallest
>of SELECTS.

That's simpy wrong. I've tested it, and I've used the moitoring tools to
watch the SQL. Unless you do something on the Access side that forces it to
do processing locally like joining or filtering on a function, or your query
is just too complex for Access to translate (rare) or if you are missing
indexes on joined fields (and why would you do that on purpose),
Access/DAO/Jet quite happily builds server-side SQL and executes it on the
server.

In the rare cases when I find a query is insisting on processing locally, I
turn part or all of it into a stored procedure or view.

>I can't begin to tell you how many times Access has either locked up, or I've
>gotten impatient at the wait of a mutli-table query designed in the QBE, but
>when run right from Query Analyzer returns records in less than 1 second.

Over time, I have gained an intuitive sense of what queries are dangerous that
way and which are not. It is tru that some time can be wasted with this now
and again.

>Everyone of my combo boxes use Pass-through SELECTS. The performance increase
>over JET selects REQUIRES IT, especially when connecting over the internet.
>(one-to-one NAT)

I have not had the performance issues you describe. It soed seem to help to
make the query DISTINCT, though, so Access will use a snapshot, and not a
Dynaset which would make more than the necessary number of round trips for a
read-only result.

>Don't get me wrong...I take FULL ADVANTAGE of JET/DAO-based front ends (local
>tables, specs, QBE), and I may even come up with an absolute must someday. I
>even prefer DAO over ADO, but that's only because I KNOW that I'm more familiar
>with it!
>My bottom line is this: I'll listen to criticism of ADPs any day (although my
>recent ADP projects have been successful, I have lots more exeperince with
>MDB), but I can't take it when Access-lovers (I'm one) actually say with a
>straight face that JET can perform in any way "as good as" SQL Server views,
>SPs, or dynamic SQL.

Well, I hate to be one of those people (actually, I'm and Access lover/hater,
and I'd take ADO.NET over Jet any day in a C/S project not done in Access),
but what you desccribe has not been my experience. It is true that some
queries need to be translated to run efficiently, but my experience is that
most don't, and in that case, they shouldn't.

I realize we just have to agree to disagree on much of this, but I think it's
important that both of our opinions are fully expressed for the record.

>Just the fact that an extra layer is involved ought to be enough proof...

From what I can tell, ADO/OLEDB is actually a much more complex stack of
layers than DAO/JET/ODBC, and some of what the DAO layer contains is very
beneficial such as the ability to use SQL to join tables from muliple sources,
and the caching of schema data in the front-end rather than looking it up
repeatly from the back-end.

Sunday, March 11, 2012

Accelerating MS SQL Client

Does a product exist that might solve the following problem?

I have an application developed in VB6 that accesses data residing on a
central Microsoft SQL server in our datacenter. While I would argue
that this application stinks, I have been assigned to deploy it to the
laptops of about 100 people. These people travel to sites and connect
to the SQL server using a VPN connection and MDAC 2.8. In testing, I
found that the performance of this application suffers when connecting
to SQL via VPN, and since this application seems to hammer SQL when
loading menus in the least optimum way possible, the program will hang
while waiting for data.

Is there software I can install on the users' laptops that might
"accelerate" the connection to the SQL server? Perhaps this software
might be an alternative to the Microsoft-provided SQL client? I saw a
product called ZCache that seems to provide some caching functionality
for Oracle and MySQL databases, but nothing for MS SQL.Joe (josephtermine@.hotmail.com) writes:
> Does a product exist that might solve the following problem?
> I have an application developed in VB6 that accesses data residing on a
> central Microsoft SQL server in our datacenter. While I would argue
> that this application stinks, I have been assigned to deploy it to the
> laptops of about 100 people. These people travel to sites and connect
> to the SQL server using a VPN connection and MDAC 2.8. In testing, I
> found that the performance of this application suffers when connecting
> to SQL via VPN, and since this application seems to hammer SQL when
> loading menus in the least optimum way possible, the program will hang
> while waiting for data.
> Is there software I can install on the users' laptops that might
> "accelerate" the connection to the SQL server? Perhaps this software
> might be an alternative to the Microsoft-provided SQL client? I saw a
> product called ZCache that seems to provide some caching functionality
> for Oracle and MySQL databases, but nothing for MS SQL.

That sounds like about an impossible thing for me. Then again, if there is
such a product for Oracle or MySQL, I guess it should be possible for
MS SQL Server. Yet then again, the accellerating effect of that product
may apply only to certain usage patterns.

Of course, if one analyses what this product is upto, it is possible
that you could implement a local cache, but it would certainly be
far cheaper to fix the application itself. It sounds if there are
tons of roundtrips and server-side cursors in it.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||"Joe" <josephtermine@.hotmail.com> wrote in message
news:1108413195.029686.70090@.z14g2000cwz.googlegro ups.com...
> Does a product exist that might solve the following problem?
> I have an application developed in VB6 that accesses data residing on a
> central Microsoft SQL server in our datacenter. While I would argue
> that this application stinks, I have been assigned to deploy it to the
> laptops of about 100 people. These people travel to sites and connect
> to the SQL server using a VPN connection and MDAC 2.8. In testing, I
> found that the performance of this application suffers when connecting
> to SQL via VPN, and since this application seems to hammer SQL when
> loading menus in the least optimum way possible, the program will hang
> while waiting for data.
> Is there software I can install on the users' laptops that might
> "accelerate" the connection to the SQL server? Perhaps this software
> might be an alternative to the Microsoft-provided SQL client? I saw a
> product called ZCache that seems to provide some caching functionality
> for Oracle and MySQL databases, but nothing for MS SQL.

If you just connect VB6 bound datagrids to sql server and that's your lot
then you'll potentially get a hell of a lot of IO.
Plus the ones in the box didn't work so well, maybe they're patched or third
party or whatever.
It does sound that the app was developed without considering what's likely
over something like a 28k connection.

I've used vpn.
It can be very slow.
It can also have a limit on concurrent users, depending on how you're
vpn-ing.

Personally, I would have thought caching some data in a local database of
some sort a must.
At least for the sort of app this sounds like.
Whether that would best be an access mdb, full msde installation or whatever
would depend on the details.
vb.net and xml on the laptops would be another alternative but quite likely
involving a complete rewrite.

--
Regards,
Andy O'Neill|||I suspect that this application does use the VB6 grids out of the box,
and these are known to be resource-intensive. The newer VB.NET grids
seem to perform better in disconnected environments.

Anyway, there doesn't seem to be much we can do if we don't have access
to the VB6 source code.

Might there be a VPN accelerator we could try? Would this help us much?|||There are tons of round-trips with this application, but as we don't
have access to the VB6 source (this is an off-the-shelf product) there
might not be much we can do to fix the inefficiencies or implement a
local cache. There's a lot to think about.|||Joe (josephtermine@.hotmail.com) writes:
> There are tons of round-trips with this application, but as we don't
> have access to the VB6 source (this is an off-the-shelf product) there
> might not be much we can do to fix the inefficiencies or implement a
> local cache. There's a lot to think about.

The one thing I can think would be replication. Assuming that you can
update from the app, that would be merge replication.

And, no, I have experience of merge replication. (And not much of other
sorts of replication either.)

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||On 15 Feb 2005 10:33:18 -0800, Joe wrote:

> I suspect that this application does use the VB6 grids out of the box,
> and these are known to be resource-intensive. The newer VB.NET grids
> seem to perform better in disconnected environments.
> Anyway, there doesn't seem to be much we can do if we don't have access
> to the VB6 source code.
> Might there be a VPN accelerator we could try? Would this help us much?

Perhaps this could help?
http://sqlrelay.sourceforge.net/

It looks complicated, but it might suit you.

Replication of the database to a local MSDE might be another choice.|||"Joe" <josephtermine@.hotmail.com> wrote in message
news:1108492398.045929.319930@.l41g2000cwc.googlegr oups.com...
>I suspect that this application does use the VB6 grids out of the box,
> and these are known to be resource-intensive. The newer VB.NET grids
> seem to perform better in disconnected environments.

I used to use flexgrid to display data, user clicks on a row and gets a
bunch of text/combo boxes to work on it .
I worte my own code to update.
This was because of the bugs in the datagrid.
You might want to investigate those.
I forget but there are circs when updates just didn't happen.

WIth dotnet I use the datagrids and they're good.
The dataadaptor and (disconnected) dataset functionality is very useful.
There would be issues meant added code in an app where a salesman wants to
use the thing completely disconnected from the database.

> Anyway, there doesn't seem to be much we can do if we don't have access
> to the VB6 source code.

Well... that's a mistake someone's made right there.

> Might there be a VPN accelerator we could try? Would this help us much?

No idea mate.

--
Regards,
Andy O'Neill

abt RTRIM/LTRIM ,Null values

Hi
can any one solve my problem; i could not get solution for following
query
I have two tables like tblOrg and tblorgchartreport
so i need to update tblorg for newly inserted rows with
tblorgchartreport, suppose there are firstname, lastname
so i need to update these fields in tblorg by triming two fields like
i need to get firstname + lastname from tblorgchartreport into
firstname of tblorg. so i have few null values in lastname fields .
so can any one tell me how to solve avoid null values while using RTRIM
or LTRIM when inserting values
waiting for reply thank you in advance
*** Sent via Developersdex http://www.developersdex.com ***Hi
You can use this way:
SELECT LTRIM(RTRIM(ISNULL(FirstName,''))) + LTRIM(RTRIM(ISNULL(LastName,'')))
--
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
---
"krishna nellutla" wrote:
> Hi
> can any one solve my problem; i could not get solution for following
> query
> I have two tables like tblOrg and tblorgchartreport
> so i need to update tblorg for newly inserted rows with
> tblorgchartreport, suppose there are firstname, lastname
> so i need to update these fields in tblorg by triming two fields like
> i need to get firstname + lastname from tblorgchartreport into
> firstname of tblorg. so i have few null values in lastname fields .
> so can any one tell me how to solve avoid null values while using RTRIM
> or LTRIM when inserting values
> waiting for reply thank you in advance
>
> *** Sent via Developersdex http://www.developersdex.com ***
>|||Does this help?
use tempdb
go
create table names (f varchar(30), l varchar(30))
go
insert names (f,l) values ('krishna','nellutla')
insert names (f,l) values ('mark','allison')
insert names (f,l) values ('ben',null)
set concat_null_yields_null off
select rtrim(l) + ', ' + ltrim(f) from names
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
krishna nellutla wrote:
> Hi
> can any one solve my problem; i could not get solution for following
> query
> I have two tables like tblOrg and tblorgchartreport
> so i need to update tblorg for newly inserted rows with
> tblorgchartreport, suppose there are firstname, lastname
> so i need to update these fields in tblorg by triming two fields like
> i need to get firstname + lastname from tblorgchartreport into
> firstname of tblorg. so i have few null values in lastname fields .
> so can any one tell me how to solve avoid null values while using RTRIM
> or LTRIM when inserting values
> waiting for reply thank you in advance
>
> *** Sent via Developersdex http://www.developersdex.com ***

Thursday, March 8, 2012

Absurdal affair in trigger file

Hi!


I found a bug in my trigger and i don't know why it is error.

See small report:

After executing following code's fragment in my trigger:

print '************** koszt sadowe *****************' + str(@.orzecz_koszty_sadowe)
print '************** koszt mks *****************' + str(@.orzecz_mks_przyznane)
print '************** koszt korespondencji *****************' + str(@.orzecz_zasadzona_zaliczka_na_koresp)

-- Potrzebne do wstawienia pozycji 'Koszty sadowe'
IF @.orzecz_koszty_sadowe IS NULL
SET @.orzecz_koszty_sadowe = 0
IF @.orzecz_mks_przyznane IS NULL
SET @.orzecz_mks_przyznane = 0

IF @.orzecz_oplaty_pozostale IS NULL
SET @.orzecz_oplaty_pozostale = 0

IF @.orzecz_zasadzona_zaliczka_na_koresp IS NULL
SET @.orzecz_zasadzona_zaliczka_na_koresp = 0

-- Koniec sprawdzanie czy sa NULL


print '************** koszt sadowe *****************' + str(@.orzecz_koszty_sadowe)
print '************** koszt mks *****************' + str(@.orzecz_mks_przyznane)
print '************** koszt korespondencji *****************' + str(@.orzecz_zasadzona_zaliczka_na_koresp)

we have on consolle following result:

************** koszt sadowe ***************** 145
************** koszt mks ***************** 123
************** koszt korespondencji ***************** 43
************** koszt sadowe ***************** 0
************** koszt mks ***************** 123
************** koszt korespondencji ***************** 43


So, variable @.orzecz_koszty_sadowe was set to 0.
Previously it was 145, so why in the if statement it values to NULL?

After small change, code looks like this:

print '************** koszt sadowe *****************' + str(@.orzecz_koszty_sadowe)
print '************** koszt mks *****************' + str(@.orzecz_mks_przyznane)
print '************** koszt korespondencji *****************' + str(@.orzecz_zasadzona_zaliczka_na_koresp)

-- Potrzebne do wstawienia pozycji 'Koszty sadowe'
IF @.orzecz_koszty_sadowe IS NULL
SET @.orzecz_koszty_sadowe = 0
IF @.orzecz_mks_przyznane IS NULL
SET @.orzecz_mks_przyznane = 0

IF @.orzecz_oplaty_pozostale IS NULL
SET @.orzecz_oplaty_pozostale = 0

IF @.orzecz_zasadzona_zaliczka_na_koresp IS NULL
SET @.orzecz_zasadzona_zaliczka_na_koresp = 0

-- Koniec sprawdzanie czy sa NULL

print '************** koszt sadowe *****************' + str(@.orzecz_koszty_sadowe)
print '************** koszt mks *****************' + str(@.orzecz_mks_przyznane)
print '************** koszt korespondencji *****************' + str(@.orzecz_zasadzona_zaliczka_na_koresp)

and the result is following:

************** koszt sadowe ***************** 145
************** koszt mks ***************** 123
************** koszt korespondencji ***************** 43
************** koszt sadowe ***************** 145
************** koszt mks ***************** 123
************** koszt korespondencji ***************** 43



So the result is proper. Now I explain the difference between
above listings. Second listing arise from first by following
transformation:

1. Place the cursor after last character of comment preceding
first IF statement (ie. after ....pozycji 'Koszty sadowe')
2. Press Enter key
3. Press Delete key (the line comes back, to initial position)

And that's all :) There's no optical difference between two
listings. However first works bad, and the second works good.

Any idea? Explanation?
I used SQL Server 2000.
Best regards
Walter

Could you please post a script that demonstrates the problem?|||Probably there was a Unix-style newline in your SQL. The query editor displays CHR(13) without CHR(10) as a new line, but the SQL processor considers the text before and after CHR(13) to be part of the same line if there is no CHAR(10).

So the SQL processor interpreted
-- Potrzebne do wstawienia pozycji 'Koszty sadowe'
IF @.orzecz_koszty_sadowe IS NULL

to mean the same thing as

-- Potrzebne do wstawienia pozycji 'Koszty sadowe' IF @.orzecz_koszty_sadowe IS NULL

The typing you did changed the CHR(13) to a valid 2-character Windows newline marker.

Steve Kass
Drew University

Absolutely Bizarre - Backup reference database that doesn't exist

Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS
It is probably a Veritas specific issue, I haven't seen it before. Worth
speaking to Veritas support.
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Jeffrey Sheldon" <jsheldon@.projecthope.org> wrote in message
news:356301c4293f$602b5eb0$a101280a@.phx.gbl...
Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS
|||In Enterprise Manager, expand to Management > SQL Server Agent > Jobs, and look for your job that is backing up to your tape drive (you may also try under Management > Database Maintenance Plans).
Have a look in the Steps tab of this jobs Properties, and there should be a Step referring to model4IDR.ckp.
Alternatively, if your maintenance plan gets its instructions from a text file, find that text file and search it for references to your erroneous database.
I have the same error right now, but it's for databases that do exist. It turns out that when we had a crash the other week, the CD ROM was removed from my server, resulting in my secondary HDD moving from F:\ to E:\. Obviously the files for some of my existing databases cannot be found. It just shows that this error message usually means exactly what it says.
If you cannot find the file it is looking for, I suggest creating a text file of the same name and location (it couldn't hurt!!), and let it find that.
Lastly, that DB name looks TOO MUCH like the model db that all SQL Servers have, so exercise CAUTION. Cheers.|||This has to do with the Intelligent Disaster Recovery feature of Backup Exec. The fix, detailed here, is creating a directory named 'backup' under the MSSQL$BKUPEXEC directory.

Absolutely Bizarre - Backup reference database that doesn't exist

Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTSIt is probably a Veritas specific issue, I haven't seen it before. Worth
speaking to Veritas support.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Jeffrey Sheldon" <jsheldon@.projecthope.org> wrote in message
news:356301c4293f$602b5eb0$a101280a@.phx.gbl...
Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS|||In Enterprise Manager, expand to Management > SQL Server Agent > Jobs,
and look for your job that is backing up to your tape drive (you may
also try under Management > Database Maintenance Plans).
Have a look in the Steps tab of this jobs Properties, and there should
be a Step referring to model4IDR.ckp.
Alternatively, if your maintenance plan gets its instructions from a
text file, find that text file and search it for references to your
erroneous database.
I have the same error right now, but it's for databases that do exist.
It turns out that when we had a crash the other week, the CD ROM was
removed from my server, resulting in my secondary HDD moving from F:\
to E:\. Obviously the files for some of my existing databases cannot be
found. It just shows that this error message usually means exactly what
it says.
If you cannot find the file it is looking for, I suggest creating a
text file of the same name and location (it couldn't hurt!!), and let
it find that.
Lastly, that DB name looks TOO MUCH like the model db that all SQL
Servers have, so exercise CAUTION. Cheers.
smithy
---
Posted via http://www.mcse.ms
---
View this thread: http://www.mcse.ms/message599918.html

Absolutely Bizarre - Backup reference database that doesn't exist

Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTSIt is probably a Veritas specific issue, I haven't seen it before. Worth
speaking to Veritas support.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Jeffrey Sheldon" <jsheldon@.projecthope.org> wrote in message
news:356301c4293f$602b5eb0$a101280a@.phx.gbl...
Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS|||In Enterprise Manager, expand to Management > SQL Server Agent > Jobs
and look for your job that is backing up to your tape drive (you ma
also try under Management > Database Maintenance Plans).
Have a look in the Steps tab of this jobs Properties, and there shoul
be a Step referring to model4IDR.ckp.
Alternatively, if your maintenance plan gets its instructions from
text file, find that text file and search it for references to you
erroneous database.
I have the same error right now, but it's for databases that do exist
It turns out that when we had a crash the other week, the CD ROM wa
removed from my server, resulting in my secondary HDD moving from F:
to E:\. Obviously the files for some of my existing databases cannot b
found. It just shows that this error message usually means exactly wha
it says.
If you cannot find the file it is looking for, I suggest creating
text file of the same name and location (it couldn't hurt!!), and le
it find that.
Lastly, that DB name looks TOO MUCH like the model db that all SQ
Servers have, so exercise CAUTION. Cheers
-
smith
----
Posted via http://www.mcse.m
----
View this thread: http://www.mcse.ms/message599918.htm

Tuesday, March 6, 2012

About the new MSDE

I am in the process of downgrading an MSDE database to a Jet (Access)
database for the following reason:
1. Size: Deployment of an MSDE database engine is inflating my distribution
file (Setup.exe) over 20 Megs! With an Access database this number is ZERO
because all the infrastructure to access my Access database is already
included on the .Net framework.
2. Setup: MSDE is complex to setup, you pretty much have to use an installer
to accomplish this where with an Access database you just copy the mdb file
and you are done.
3. Maintainability: With MSDE I will have to issue independent patches for
fixes to the MSDE engine where with an Access database, fixes are included
in the .Net framework service pack.
4. Portability: With a .Net application and an Access database, I could copy
my program and the database into a USB memory stick or a writable CD and
actually run my application from there, this is a big deal for me as people
can carry my application on their USB keychain and use it any time in any
computer. This is not possible with MSDE.
Number 1 & 4 are biggies for me. The think that really bothers me is that my
application already runs online against an SQL server database so using an
MSDE to have the database running locally makes it EXTREMELY simple for me
because I can use the exact same SQL server database directly were with
access I will have create a new database, rewrite my stored procedure logic
and maintain 2 database (online SQL server and local Access database).
If the new version of MSDE is basically the same thing as the old MSDE
except that it has more features then I guess I am doomed and I will have to
use an Access database.
Any comment regarding my predicament are very much appreciated. Thanks.
hi Rene,
Rene wrote:
> I am in the process of downgrading an MSDE database to a Jet (Access)
> database for the following reason:
> 1. Size: Deployment of an MSDE database engine is inflating my
> distribution file (Setup.exe) over 20 Megs! With an Access database
> this number is ZERO because all the infrastructure to access my
> Access database is already included on the .Net framework.
actually 43mb :D
http://www.microsoft.com/downloads/d...displaylang=en

> 2. Setup: MSDE is complex to setup, you pretty much have to use an
> installer to accomplish this where with an Access database you just
> copy the mdb file and you are done.
right, but the installer can really be a little companion tool that provides
an UI to the setup.exe boostrap installer to gather all required parameters
and user options, then shells to setup.exe... but ok, it's more complex than
mdb file copy..

> 3. Maintainability: With MSDE I will have to issue independent
> patches for fixes to the MSDE engine where with an Access database,
> fixes are included in the .Net framework service pack.
AFAIK .Net FWK does not contain MDAC... and MDAC itself, up to v. 2.6 no
longer provides the JET components, so you manually have to install/upgrade
it.. ok, actual Win OS releases already have it as part of core
installation, but you have to manually upgrade JET "things"..

> 4. Portability: With a .Net application and an Access database, I
> could copy my program and the database into a USB memory stick or a
> writable CD and actually run my application from there, this is a big
> deal for me as people can carry my application on their USB keychain
> and use it any time in any computer. This is not possible with MSDE.
you can do sort of this with MSDE too... your application must attach the
dbs residing on the USB key at application start up, and obviously detach
them before key removal (or the dbs will be marked as suspect).. this is not
the very best solution for SQL Server database, both for performance and
security reasons, but it can be done... and, of course, even if this is an
MSDE default setting, set the autoclose db option :D
just a side note... I recently bought an USB key and read something about
100.000 writes warranty...
well, I really do not know how long does it takes for SQL Server/MSDE (but
even JET) to exceed this value, but I'd expect not that much time... so
stay tuned :D

> Number 1 & 4 are biggies for me. The think that really bothers me is
> that my application already runs online against an SQL server
> database so using an MSDE to have the database running locally makes
> it EXTREMELY simple for me because I can use the exact same SQL
> server database directly were with access I will have create a new
> database, rewrite my stored procedure logic and maintain 2 database
> (online SQL server and local Access database).
> If the new version of MSDE is basically the same thing as the old MSDE
> except that it has more features then I guess I am doomed and I will
> have to use an Access database.
SQLExpress will support (single user) User Instances,
http://tinyurl.com/bm3to , that combined with .Net XCopy deployment can
perhaps get your point...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.15.0 - DbaMgr ver 0.60.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Hi Andrea:

> AFAIK .Net FWK does not contain MDAC... and MDAC itself, up to v. 2.6 no
> longer provides the JET components, so you manually have to
> install/upgrade it.. ok, actual Win OS releases already have it as part of
> core installation, but you have to manually upgrade JET "things"..
I know for sure of two things about this Access db trip. The first one is
that I am using ADO.Net as my data object layer and the second one, that I
am using the Microsoft.Jet.OLEDB.4.0 provider and as a result the Jet
engine.
I did some research on the web and found out that it looks like the
"smarties" form Microsoft are retiring the Jet engine and we now can all
look forward to having to distribute a 70 Megabytes SQL express to go with
our little 2 meg applications.
It also looks like the Jet engine is indeed distributed with the OS (after
Win 2000), I am wondering if this will stop happening with new OS versions.
For earlier version of Windows I guess I will have to distribute the MDAC
2.6 and pray that that comes with Jet 4.0
Frankly, I think this is absolutely retarded, Access/Jet were perfect for
your average database application and it should be fully supported and
distribute on the .Net. This is REALLY stupid.
|||> Frankly, I think this is absolutely retarded, Access/Jet were perfect for
> your average database application and it should be fully supported and
> distribute on the .Net. This is REALLY stupid.
Luckily it seems both Access and Jet will survive.
Check this:
http://blogs.msdn.com/access/
Jesper
|||I don't know where you did your research on the web, but it is
absolutely inaccurate. Access/Jet will continue to be supported for
exactly the scenario you describe, and is being enhanced for Office
12, which is now in limited technical beta.
Bear in mind that Access/Jet is not recommended for Web apps or even
heavy-duty intranet apps, and you should be fine.
--Mary
On Fri, 18 Nov 2005 15:19:43 -0600, "Rene" <nospam@.nospam.com> wrote:

>Hi Andrea:
>
>I know for sure of two things about this Access db trip. The first one is
>that I am using ADO.Net as my data object layer and the second one, that I
>am using the Microsoft.Jet.OLEDB.4.0 provider and as a result the Jet
>engine.
>I did some research on the web and found out that it looks like the
>"smarties" form Microsoft are retiring the Jet engine and we now can all
>look forward to having to distribute a 70 Megabytes SQL express to go with
>our little 2 meg applications.
>It also looks like the Jet engine is indeed distributed with the OS (after
>Win 2000), I am wondering if this will stop happening with new OS versions.
>For earlier version of Windows I guess I will have to distribute the MDAC
>2.6 and pray that that comes with Jet 4.0
>Frankly, I think this is absolutely retarded, Access/Jet were perfect for
>your average database application and it should be fully supported and
>distribute on the .Net. This is REALLY stupid.
>

Saturday, February 25, 2012

About Stored Procedure

hi there,

I am using SQL after a long time and want to use stored procedure ofor the following purpose:

i have to db of all the names of agents all over US.i am using a formulata to calculate zip to zip distance so that when the user gets a order and hits"find agents" ..it calculates the distances by using latitude and longitude calculation and displays all the agents who are around 50 mile in radius with tthe zip code specified in the order.

I wanted to know if I could store this formula in a stored procedure so that all teh calculations are done by SQL and stored in a temp table..beucase the same thing i did in Access(obviously access doesnt have Stored proicedure and i wrote a program called calculate.asp to calculate diostances) its running slow and thats the only reason i am using SQL.

i dont know where to start from...any help/links/ideas on how to do it ,whether its possible to do it thru stored procedures...if so then how to write stored procedures?

hi,

yes, you can put that "solving" code in a stored procedure...

for instance, assuming you have "areas" indicated in an x,y cartesian table of 3x3 cells as the following trivial sample, you can get the related agent based on the join of the area and agents tables...

SET NOCOUNT ON;

USE tempdb;

GO

CREATE TABLE dbo.Area (

Id int NOT NULL IDENTITY PRIMARY KEY,

Name varchar(10) NOT NULL,

X int NOT NULL,

Y int NOT NULL

);

CREATE TABLE dbo.Agent (

Id int NOT NULL IDENTITY PRIMARY KEY,

Name varchar(10) NOT NULL,

IdArea int NOT NULL

);

INSERT INTO dbo.Area VALUES ( 'a', 1 , 1 );

INSERT INTO dbo.Area VALUES ( 'b', 2 , 1 );

INSERT INTO dbo.Area VALUES ( 'c', 3 , 1 );

INSERT INTO dbo.Area VALUES ( 'd', 1 , 2 );

INSERT INTO dbo.Area VALUES ( 'e', 2 , 2 );

INSERT INTO dbo.Area VALUES ( 'f', 3 , 2 );

INSERT INTO dbo.Area VALUES ( 'g', 1 , 3 );

INSERT INTO dbo.Area VALUES ( 'h', 2 , 3 );

INSERT INTO dbo.Area VALUES ( 'i', 3 , 3 );

INSERT INTO dbo.Agent VALUES ( 'agent a', 1 );

INSERT INTO dbo.Agent VALUES ( 'agent b', 2 );

INSERT INTO dbo.Agent VALUES ( 'agent c', 3 );

INSERT INTO dbo.Agent VALUES ( 'agent d', 4 );

INSERT INTO dbo.Agent VALUES ( 'agent e', 5 );

INSERT INTO dbo.Agent VALUES ( 'agent f', 6 );

INSERT INTO dbo.Agent VALUES ( 'agent g', 7 );

INSERT INTO dbo.Agent VALUES ( 'agent h', 8 );

INSERT INTO dbo.Agent VALUES ( 'agent i', 9 );

DECLARE @.x int, @.y int;

SELECT @.x = 3, @.y = 1

SELECT a.Name AS [AreaName], g.Name AS [AgentName]

FROM dbo.Area a

JOIN dbo.Agent g

ON g.IdArea = a.Id

WHERE a.X = @.x AND a.Y = @.y

PRINT 'all agents and related areas';

SELECT a.Name AS [AreaName], g.Name AS [AgentName]

FROM dbo.Area a

JOIN dbo.Agent g

ON g.IdArea = a.Id;

DROP TABLE dbo.Agent, dbo.Area;

--<

AreaName AgentName

- -

c agent c

all agents and related areas

AreaName AgentName

- -

a agent a

b agent b

c agent c

d agent d

e agent e

f agent f

g agent g

h agent h

i agent i

the procedure related code could be as easy as the following related trivial code

CREATE PROCEDURE dbo.GetAgentByArea (

@.x int,

@.y int

)

AS BEGIN

SELECT a.Name AS [AreaName], g.Name AS [AgentName]

FROM dbo.Area a

JOIN dbo.Agent g

ON g.IdArea = a.Id

WHERE a.X = @.x AND a.Y = @.y;

END;
GO

EXEC dbo.GetAgentByArea 1,1;

EXEC dbo.GetAgentByArea 3,2;

GO

DROP PROCEDURE dbo.GetAgentByArea

or as complicated as necessary..

regards

About SQLClient conters

Hi,
how can i get the following list of counters
in runtime when we executing the application with
database support and is there any command to find the
no.of connection are made in the database and no.of pooled
connection, no.of non pooled connection for the database.> Hi,
> how can i get the following list of counters
> in runtime when we executing the application with
> database support and is there any command to find the
> no.of connection are made in the database and no.of pooled
> connection, no.of non pooled connection for the database.
>
--
You should look at incorporating Windows Management Instrumentation (WMI)
into your application. This is a place to start:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/
wmi_start_page.asp
Hope this helps,
--
Eric Cárdenas
Senior support professional
This posting is provided "AS IS" with no warranties, and confers no rights.

about SQL Suspect status

my corporate database appear Suspect status!
and i run sp_resetstatus then stop
last i restart SQL!
but it appear following information:
Could not locate row in sysobjects for system catalog 'Sysobjects' in
database 'NVS1'. This system catalog should exist in all databases. Run DBCC
CHECKTABLE on sysobjects in this database.
what should i do ?Hi Allen,
Your database appears to be corrupted. Do you have backup?
Also you may want to do a hardware diagnostic to look for possible hardware
problem.
Sincerely,
Yih-Yoon Lee [Microsoft]
Microsoft SQL Server Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.|||First Thanks your reply!
But,My backup every night! one day has lost!
My God! my salary is reducing? can you help me?
can you give me a plan about how backup so huge database!?
"Yih-Yoon Lee [MS]" <yihyoonl@.online.microsoft.com> wrote in message
news:$tOtmU$YDHA.396@.cpmsftngxa06.phx.gbl...
> Hi Allen,
> Your database appears to be corrupted. Do you have backup?
> Also you may want to do a hardware diagnostic to look for possible
hardware
> problem.
> Sincerely,
> Yih-Yoon Lee [Microsoft]
> Microsoft SQL Server Support
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
>

Sunday, February 19, 2012

ABout SELECT Syntax?

Hi,everyone.

Today I met with a interesting problem. According to Microsoft SQL SERVER 2005 BOOKS ONLINE, there is following SELECT Syntax:

(1) SELECT @.local_variable (Transact-SQL)

For example:

DECLARE @.i int
SELECt @.i=100

(2) SELECt QUERY statement:

SELECT [ ALL | DISTINCT ]
[ TOP expression [ PERCENT ] [ WITH TIES ] ]
<select_list>
<select_list> ::=
....

For example,

[AdventureWorks]
SELECT * FROM DatabaseLog

To my surprise, in the given project, I met this kind of SELECT statement,

DECLARE @.w_type varchar(10), @.i varchar(30)
SELECT @.i='3'
SELECT @.w_type='OLTPNORMAL' WHERE @.i IN ('0','1','2','3','4','5','9',)
SELECT @.w_type

The result is:

OLTPNORMAL

However, I have not met with the kind of SELECT statement before. Please give me some advice. Thank you in advance.DECLARE @.w_type varchar(10), @.i varchar(30)
SELECT @.i='3'
SELECT @.w_type='OLTPNORMAL' WHERE @.i IN ('0','1','2','3','4','5','9')
SELECT @.w_type

The result is:

OLTPNORMAL

Thats absolutely okay,

SELECT @.i='3' -- assigning value '3' to @.i

SELECT @.w_type='OLTPNORMAL' WHERE @.i IN ('0','1','2','3','4','5','9') -- Assigning @.w_type='OLTPMORMAL' if where clause satisfies,here it is satisfying bcoz @.i='3'
SELECT @.w_type -displaying @.w_type|||Thank you,Rudra.

Here I have gotten the same result as yours. However, the kind of SQL Synax "SELECT...@.local_variable ...WHERE..." is not introduced in SQL SERVER 2005 in Microsoft SQL SERVER 2005 BOOKS ONLINE. So when I found this statement I felt surprised. Can you give me some advice to look for some introductions about the kind of SQL Synax ?

Thank you very much!|||Read this ...LINK (http://msdn2.microsoft.com/en-us/library/ms189484.aspx)
And please read the whole topic( you must scroll down) and then everything will be clear to you.

about query ..

Hi all,
Does anyone know what is the following query mean:
select * from abc,def from abc.xx(+) = def.xx
i have no idea about the (+) symbol..what it represent?
Thank you in advance
Best regards,
Ocurnos
Hi,
Its Left outer join in Oracle. SQL Server will give you syntax error.
Thanks
Hari
SQL Server MVP
"Daniel" <Daniel@.discussions.microsoft.com> wrote in message
news:8453A3AC-B95C-45B0-B117-79EE86FCF452@.microsoft.com...
> Hi all,
> Does anyone know what is the following query mean:
> select * from abc,def from abc.xx(+) = def.xx
> i have no idea about the (+) symbol..what it represent?
> Thank you in advance
> Best regards,
> Ocurnos

about query

Hi all,
Does anyone know what is the following query mean:
select * from abc,def where abc.xx(+) = def.xx
i have no idea about the (+) symbol..what it represent?
Thank you in advance
Best regards,
Ocurnos
As I know that + Symbol to used to join string.
example below
SELECT top 10 Title_ID + Title As "Title_ID + Title", * FROM
[pubs].[dbo].[titles]
Regards,
Rajesh
"Daniel" wrote:

> Hi all,
> Does anyone know what is the following query mean:
> select * from abc,def where abc.xx(+) = def.xx
> i have no idea about the (+) symbol..what it represent?
> Thank you in advance
> Best regards,
> Ocurnos

Saturday, February 11, 2012

About EXEC dynamic query ?

Hello SQL Scripters,
I have the following MS/SQL server 2000 Script:
*******************
use NorthWind
GO
declare @.RecordCount int
,@.SelectString varchar(80)
,@.QueryString varchar(80)
,@.sQuote varchar(1)
set @.sQuote=''''
set @.QueryString='LastName like '+@.sQuote+'%'+'Kos'+'%'+@.sQuote
set @.SelectString='select count(*) from dbo.Employees where
'+@.QueryString
set @.RecordCount=0
exec(@.SelectString)
GO
*******************
How can I extract the result to the local variable @.RecordCount ?
In my case, I have to use the EXEC method to perform dynamic query.
TIA
Thomas
I got it. I use @.@.ROWCOUNT
Thanks
Thomas
|||No actually that is not the correct way. First off there is no need to use
dynamic sql at all here as the SARG can be a variable.
DECLARE @.x VARCHAR(50), @.y INT
SET @.x = @.sQuote+'%'+'Kos'+'%'+@.sQuote
select count(*) from dbo.Employees where
LastName like @.x
If you want the count in a variable you can do this:
select @.y = count(*) from dbo.Employees where
LastName like @.x
And if you did have the need to use dynamic sql and wanted to return a value
you should use sp_executesql instead. See here for more details:
http://www.support.microsoft.com/?id=262499 Using OutPut Params &
sp_executeSql
http://www.sommarskog.se/dynamic_sql.html Dynamic SQL
Andrew J. Kelly SQL MVP
"Thomas McFarlane" <TM@.HotMeal.Com> wrote in message
news:OrH$yzr3EHA.1188@.tk2msftngp13.phx.gbl...
>I got it. I use @.@.ROWCOUNT
> Thanks
> Thomas
>
|||Andrew,
Thanks for your response. The problem with my requirement is that I have to
construct the dynamic SQL string. This is a "Procedure" that allows the user
to submit fields s/he wishes to query against a selected Table and selected
list of fields within a selected table at runtime.
Therefore, your instruction "select count(*) from dbo.Employees where
LastName like @.x" will not work for me because the field "LastName" is also
dynamic (unknown at design time).
Here is my Procedure in real life: (@.QryString can be as "LastName like
'Woo%' and Occupation='Golf' order by LastName,WinningScore; @.TableName can
be "GolfTournament"; @.RV=Return Value that holds the number of records; and
finally, the returned dataset (not shown here))
****************************
Create Procedure tQuery
@.QryString varchar(2048)
, @.Tablename varchar(60)
, @.RV int out as
Declare @.s varchar(2048)
set @.s='select * from '+@.TableName+' Where '+@.QryString
EXEC(@.s)
set @.RV=@.@.ROWCOUNT --This always gives me the accurate number of
records returned by the @.QryString
Return @.RV
Go
*****************************
As a result, I had to use the @.@.ROWCOUNT immediately after the EXEC(@.s). My
goal is to count 1st to make sure there is data for a submitted QryString,
but I just cannot simply say:
set @.RV=(select count(*) from @.Tablename where @.QryString
The above instreuction just does not compile.
Thomas
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23umX%23Ks3EHA.1976@.TK2MSFTNGP09.phx.gbl...
> No actually that is not the correct way. First off there is no need to
> use dynamic sql at all here as the SARG can be a variable.
>
> DECLARE @.x VARCHAR(50), @.y INT
> SET @.x = @.sQuote+'%'+'Kos'+'%'+@.sQuote
> select count(*) from dbo.Employees where
> LastName like @.x
>
> If you want the count in a variable you can do this:
>
> select @.y = count(*) from dbo.Employees where
> LastName like @.x
>
> And if you did have the need to use dynamic sql and wanted to return a
> value you should use sp_executesql instead. See here for more details:
>
> http://www.support.microsoft.com/?id=262499 Using OutPut Params &
> sp_executeSql
> http://www.sommarskog.se/dynamic_sql.html Dynamic SQL
>
> --
> Andrew J. Kelly SQL MVP
>
> "Thomas McFarlane" <TM@.HotMeal.Com> wrote in message
> news:OrH$yzr3EHA.1188@.tk2msftngp13.phx.gbl...
>
|||If you simply want to find out if there are any rows that match the query
you should use EXISTS instead of count(*) as it can be much more efficient.
But in any case the links I sent should be helpful in working with dynamic
sql.
Andrew J. Kelly SQL MVP
"Thomas McFarlane" <TM@.HotMeal.Com> wrote in message
news:efgZqjs3EHA.4004@.tk2msftngp13.phx.gbl...
> Andrew,
> Thanks for your response. The problem with my requirement is that I have
> to construct the dynamic SQL string. This is a "Procedure" that allows the
> user to submit fields s/he wishes to query against a selected Table and
> selected list of fields within a selected table at runtime.
> Therefore, your instruction "select count(*) from dbo.Employees where
> LastName like @.x" will not work for me because the field "LastName" is
> also dynamic (unknown at design time).
> Here is my Procedure in real life: (@.QryString can be as "LastName like
> 'Woo%' and Occupation='Golf' order by LastName,WinningScore; @.TableName
> can be "GolfTournament"; @.RV=Return Value that holds the number of
> records; and finally, the returned dataset (not shown here))
> ****************************
> Create Procedure tQuery
> @.QryString varchar(2048)
> , @.Tablename varchar(60)
> , @.RV int out as
> Declare @.s varchar(2048)
> set @.s='select * from '+@.TableName+' Where '+@.QryString
> EXEC(@.s)
> set @.RV=@.@.ROWCOUNT --This always gives me the accurate number of
> records returned by the @.QryString
> Return @.RV
> Go
> *****************************
> As a result, I had to use the @.@.ROWCOUNT immediately after the EXEC(@.s).
> My goal is to count 1st to make sure there is data for a submitted
> QryString, but I just cannot simply say:
> set @.RV=(select count(*) from @.Tablename where @.QryString
> The above instreuction just does not compile.
> Thomas
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23umX%23Ks3EHA.1976@.TK2MSFTNGP09.phx.gbl...
>
|||"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23ZRd5tt3EHA.2804@.TK2MSFTNGP15.phx.gbl...
> If you simply want to find out if there are any rows that match the query
> you should use EXISTS instead of count(*) as it can be much more
> efficient. But in any case the links I sent should be helpful in working
> with dynamic sql.
>
Thanks Andrew. I need the RecordCount for calculation purposes. But the
EXISTS function is definitely good. I am exploring more about the links you
gave. Very good stuffs.
Take care!
Thomas