Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Tuesday, March 27, 2012

Advice on CASE statement

Can someone guide me in the correct direction as to what's going on with
this case statement:
This was derived from and access IIF statement
Access IIF statement:
IIf([meterreading] & ""="" Or [previousreading] & ""="",Null,
(IIf([MeterReading]>=[PreviousReading],[MeterReading]- [previousreading],[MeterReading]+([Rollo
ver]- [PreviousReading]))*IIf(IsNull([MultiFac
tor]),1,[MultiFactor]))+nz([UsageAdjustm
ent],0))
SQL Case statement:
select
case when 10000.0 is null or 1.0 is null
then null else case when 10000.0 >= 1.0 then (10000.0 - 1.0)
else 10000.0 + (4 - 1.0) end end * case when 22.0 is null
then 1 else 22.0 + isnull(4.0,0) end as CurUsage
Above is a sample of the case statement with the actual values instead of
the field names used in the actual statement so you may test. The result I
require and the result access renders using the exact values is 219982, but
the result I get from SQL is 259974. I believe that my case statement is
formatted incorrectly. If I simply compute all the value that would be
returned base on the case statement conditions I get the value I s.
select (10000.0 - 1.0) * 22.0 + isnull(4.0,0) = 219982
Any Ideas?
Best Regards,
Advice on Case StatementThe problem is that it will evaluate inside out. So the 22 + 4 is evaluated
prior to the multiplication.
I think just you just need to move your last END statement.
As in the following:
select
case when 10000.0 is null or 1.0 is null
then null else case when 10000.0 >= 1.0 then (10000.0 - 1.0)
else 10000.0 + (4 - 1.0) end end * case when 22.0 is null
then 1 else 22.0 end + isnull(4.0,0) as CurUsage
Ryan Powers
Clarity Consulting
http://www.claritycon.com
"Tim Harvey" wrote:

> Can someone guide me in the correct direction as to what's going on with
> this case statement:
> This was derived from and access IIF statement
> Access IIF statement:
> IIf([meterreading] & ""="" Or [previousreading] & ""="",Null,
> (IIf([MeterReading]>=[PreviousReading],[MeterReading]- [previousreading],[MeterReading]+([Rollo
ver]- [PreviousReading]))*IIf(IsNull([MultiFac
tor]),1,[MultiFactor]))+nz([UsageAdjustm
ent],0))
>
> SQL Case statement:
> select
> case when 10000.0 is null or 1.0 is null
> then null else case when 10000.0 >= 1.0 then (10000.0 - 1.0)
> else 10000.0 + (4 - 1.0) end end * case when 22.0 is null
> then 1 else 22.0 + isnull(4.0,0) end as CurUsage
> Above is a sample of the case statement with the actual values instead of
> the field names used in the actual statement so you may test. The result I
> require and the result access renders using the exact values is 219982, bu
t
> the result I get from SQL is 259974. I believe that my case statement is
> formatted incorrectly. If I simply compute all the value that would be
> returned base on the case statement conditions I get the value I s.
> select (10000.0 - 1.0) * 22.0 + isnull(4.0,0) = 219982
>
> Any Ideas?
>
> Best Regards,
> Advice on Case Statement
>
>|||1) First thing to learn is that ther is no CASE statement in SQL; there
is a CASE **expression**!! Important!! Expressions have a single data
type. Expressions have nothign to do with control flow; since SQL is a
declarative language, there is no concept whatsoever of control flow!!
This is basic programming concepts.
2) "CASE WHEN 10000.0 IS NULL OR .. " is absurd code; it is always
UNKNOWN. Do you understand the 3-Valued Logic in SQL?
3) Above is a sample of the case statement [sic] with the actual values
instead of the field [sic] names used in the actual statement so you may
test. <<
Columns are not anything like fields; please learn the foundations,
concepts and the right words. Now, how do you expect us to debug code
you will not show us? How do we tell the constants from the columns?
You failed to post even minimal DDL or a spec that makes sense. Try
again, if you really want help.
The CASE expression is an *expression* and not a control statement; that
is, it returns a value of one datatype. SQL-92 stole the idea and the
syntax from the ADA programming language. Here is the BNF for a <case
specification>:
<case specification> ::= <simple case> | <searched case>
<simple case> ::=
CASE <case operand>
<simple when clause>...
[<else clause>]
END
<searched case> ::=
CASE
<searched when clause>...
[<else clause>]
END
<simple when clause> ::= WHEN <when operand> THEN <result>
<searched when clause> ::= WHEN <search condition> THEN <result>
<else clause> ::= ELSE <result>
<case operand> ::= <value expression>
<when operand> ::= <value expression>
<result> ::= <result expression> | NULL
<result expression> ::= <value expression>
The searched CASE expression is probably the most used version of the
expression. The WHEN ... THEN ... clauses are executed in left to right
order. The first WHEN clause that tests TRUE returns the value given in
its THEN clause. And, yes, you can nest CASE expressions inside each
other. If no explicit ELSE clause is given for the CASE expression,
then the database will insert a default ELSE NULL clause. If you want
to return a NULL in a THEN clause, then you must use a CAST (NULL AS
<datatype> ) expression. I recommend always giving the ELSE clause, so
that you can change it later when you find something explicit to return.
The <simple case expression> is defined as a searched CASE expression in
which all the WHEN clauses are made into equality comparisons against
the <case operand>. For example
CASE iso_sex_code
WHEN 0 THEN 'Unknown'
WHEN 1 THEN 'Male'
WHEN 2 THEN 'Female'
WHEN 9 THEN 'N/A'
ELSE NULL END
could also be written as:
CASE
WHEN iso_sex_code = 0 THEN 'Unknown'
WHEN iso_sex_code = 1 THEN 'Male'
WHEN iso_sex_code = 2 THEN 'Female'
WHEN iso_sex_code = 9 THEN 'N/A'
ELSE NULL END
There is a gimmick in this definition, however. The expression
CASE foo
WHEN 1 THEN 'bar'
WHEN NULL THEN 'no bar'
END
becomes
CASE WHEN foo = 1 THEN 'bar'
WHEN foo = NULL THEN 'no_bar' -- error!
ELSE NULL END
The second WHEN clause is always UNKNOWN.
The SQL-92 Standard defines other functions in terms of the CASE
expression, which makes the language a bit more compact and easier to
implement. For example, the COALESCE () function can be defined for one
or two expressions by
1) COALESCE (<value exp #1> ) is equivalent to (<value exp #1> )
2) COALESCE (<value exp #1>, <value exp #2> ) is equivalent to
CASE WHEN <value exp #1> IS NOT NULL
THEN <value exp #1>
ELSE <value exp #2> END
then we can recursively define it for (n) expressions, where (n >= 3),
in the list by
COALESCE (<value exp #1>, <value exp #2>, . . ., n), as equivalent to:
CASE WHEN <value exp #1> IS NOT NULL
THEN <value exp #1>
ELSE COALESCE (<value exp #2>, . . ., n)
END
Likewise, NULLIF (<value exp #1>, <value exp #2> ) is equivalent to:
CASE WHEN <value exp #1> = <value exp #2>
THEN NULL
ELSE <value exp #1> END
It is important to be sure that you have a THEN or ELSE clause with a
datatype that the compiler can find to determine the highest datatype
for the expression.
A trick in the WHERE clause is use it for a complex predicate with
material implications.
WHERE CASE
WHEN <search condition #1>
THEN 1
WHEN <search condition #2>
THEN 1
..
ELSE 0 END = 1
Gert-Jan Strik posted some exampels of how ISNULL() and COALESCE() on
2004 Aug 19
CREATE TABLE #t(a CHAR(1));
INSERT INTO #t VALUES (NULL);
SELECT ISNULL(a,'abc') FROM #t;
SELECT COALESCE(a, 'abc') FROM #t;
DROP TABLE #t;
He always use COALESCE, with the exception of the following type of
situation, because of its performance consequences:
SELECT ...,
ISNULL((SELECT COUNT(*) -- or other aggregate
FROM B
WHERE B.key = A.key), 0)
FROM A;
Likewise, Alejandro Mesa cam up with this example:
SELECT 13 / COALESCE(CAST(NULL AS INTEGER), 2.00); -- promote to highest
type (decimal)
SELECT 13 / ISNULL(CAST(NULL AS INTEGER), 2.00); -- promote to first
type (integer)
--CELKO--
Please post DDL in a human-readable format and not a machine-generated
one. This way people do not have to guess what the keys, constraints,
DRI, datatypes, etc. in your schema are. Sample data is also a good
idea, along with clear specifications.
*** Sent via Developersdex http://www.examnotes.net ***

Sunday, March 25, 2012

Advice needed - MSDE vs. Access

Hi, I currently have a application that is being used throughout the
country at different customers. Currently it is a VB6 application accessing
DBF/CDX standalone tables via ODBC. We are developing the 'next
generation' of the program in VB.NET and will do data access via OLEDB.
Here is the issue: Stand alone Visual Foxpro DBF tables do not return
'primary key' information, so we lose a lot of potential functionality by
not being able to set relations in a Dataset. Therefore, we are looking
for a new database to host the application. The application DB requirements
are basic INSERT, UPDATE, DELETE. No data replication, or anything fancy.
No "DB security" required. In reality, the application is coded so that it
will actually run on a SQL server or Oracle enterprise DB, too. But
customers that choose that option have an IT dept with appropriate
expertise, so I'm not worried about them.
Here's the problem... most of our customers are in small shops and are
barely computer literate. We need something REALLY simple. With the DBF
files it couldn't be simpler... install the program and then run it. No
real maintenance (except backup of course) is needed. I'm looking at
either MS Access or MSDE as a replacement database. Given that my
customers are the types that use the CD drawer as a cup holder, I'm
concerned that MSDE might be too much for them, and that Access might be
easier for them. Right now this is just my initial thought, as I'm not
familiar with MSDE. Before I get too far down the road, I wanted to tap
some expertise for advise.
So, the application will be coded to the 'lowest common denominator' but
will able to run on SQL server and ORACLE also. The question is, given the
small shops I need to cater to, what should that 'lowest common denominator'
be? Access or MSDE?
Any advice graceously accepted... Thanks.
John
hi John,
JohnR wrote:
>...
> So, the application will be coded to the 'lowest common denominator'
> but will able to run on SQL server and ORACLE also. The question is,
> given the small shops I need to cater to, what should that 'lowest
> common denominator' be? Access or MSDE?
>
difficult question, as the 2 engines can not be compared... ok they are both
database engines, but very different.... from my point of view I'd go with
MSDE as it can be easily scaled to full blown SQL Server editions with no
harm at all... and as you already know, JET database engine is in
maintenance and no additional features will be provided for it..
on the other side, MSDE, and soon SQLExpress, could require some more
maintenace (you can include in you application, for quite all administrative
tasks)... but they are another level of db engines, comparable with Oracle,
where the JET engine is not...
for SQL Server connections I'd go for the SQLClient name space versus the
OLEDB conterpart asi it provides better and targeted support for the SQL
Server worls, where the OLEDB provider is quite generic... but this is
another story..
more... SQLExpress will support easy setup and deployment for your database,
as long as XCopy support...
http://msdn.microsoft.com/library/de...seoverview.asp
provides additional info..
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

Advice needed

Hi everyone,

My hoster hosts asp.net but does not yet support sql 2005 only sql 2000 and access I want to use either of the starter kits. I am confused on what is needed to make the changes to make either sql 2000 or access work. I know enough that the connection strings will need to change my concern is code. Is there strings that I will need to find and change in the application. I sure would appreciate any and all advice. Thank you for your help.

DKB

Chances are that no changes (apart from the connection string) will need to be made to accommodate Sql Server 2000. Access will need some changes to the SQL statements at the very least.

http://sqlserver2000.databases.aspfaq.com/what-are-the-main-differences-between-access-and-sql-server.html

Advice MSDE/ACCESS

I wrote an app that uses MSDE. IT is VB.NET, and there are only 10 users
tops.
To make an MSDE installation and get the database working requires me, which
makes it not really a commercially distributable product.
Would I be better just using an MDB file? Seems like MSDE is really nice
and basically SQL but I need something that installs easy--i.e. my users can
install. I know I can easily install an MDB file.
Would the MDB file be sufficient for 10-20 users tops?
thanks,
Shane
On Sat, 12 Jun 2004 02:36:37 -0500, SStory
<TheStorys@.TAKEOUTTHISSPAMBUSTERsofthome.net> wrote:

> Would the MDB file be sufficient for 10-20 users tops?
That depends on the complexity of your queries and the level of your
requirements. If you're only doing some SELECT statements and occasional
updates/inserts, an .mdb file is certainly enough. You could run into
troubles with locking mechanisms in MS Access though, so take care.
Installing MSDE is not a big deal, you just have to care for populating
the database yourself (ie: from your application) to make it easier for
your users.
Using SECURITYMODE and DBPWD(?) as setup parameters can even set up a
version of MSDE that runs similar to MSDE 1.0 (speaking of access to it)
Stefan
Give a man fire and he is warm for a day.
Set him on fire and he is warm for the rest of his life.

Advertising SQL server names

How do I turn off advertising SQL 2000 server name from applications
like Access? I don't want the server name to show up in the list of
available servers. Is there somewhere to turn off that setting?
Thanks for your help,
Mark
Tibor Karaszi wrote:
> You can do this in the "Server Network Configuration" tool. Select your
> instance, the protocol in question (for instance TCP/IP), Properties,
> and the "Hide Server" checkbox.
>
Thanks, that worked. Do you know how to do this with the SQL desktop engine?

Advertising SQL server names

How do I turn off advertising SQL 2000 server name from applications
like Access? I don't want the server name to show up in the list of
available servers. Is there somewhere to turn off that setting?
Thanks for your help,
MarkYou can do this in the "Server Network Configuration" tool. Select your inst
ance, the protocol in
question (for instance TCP/IP), Properties, and the "Hide Server" checkbox.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Mark" <mark@.nomail.com> wrote in message news:eVtWptlaHHA.2064@.TK2MSFTNGP05.phx.gbl...[vbco
l=seagreen]
> How do I turn off advertising SQL 2000 server name from applications like
Access? I don't want the
> server name to show up in the list of available servers. Is there somewher
e to turn off that
> setting?
> Thanks for your help,
> Mark[/vbcol]|||Tibor Karaszi wrote:
> You can do this in the "Server Network Configuration" tool. Select your
> instance, the protocol in question (for instance TCP/IP), Properties,
> and the "Hide Server" checkbox.
>
Thanks, that worked. Do you know how to do this with the SQL desktop engine?|||The information is probably in the registry, so check out the registry befor
e and after changing the
value and you'll see what key/value to modify.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Mark" <mark@.nomail.com> wrote in message news:%23DjNENmaHHA.1216@.TK2MSFTNGP03.phx.gbl...[vb
col=seagreen]
> Tibor Karaszi wrote:
> Thanks, that worked. Do you know how to do this with the SQL desktop engine?[/vbco
l]sql

Advertising SQL server names

How do I turn off advertising SQL 2000 server name from applications
like Access? I don't want the server name to show up in the list of
available servers. Is there somewhere to turn off that setting?
Thanks for your help,
MarkYou can do this in the "Server Network Configuration" tool. Select your instance, the protocol in
question (for instance TCP/IP), Properties, and the "Hide Server" checkbox.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Mark" <mark@.nomail.com> wrote in message news:eVtWptlaHHA.2064@.TK2MSFTNGP05.phx.gbl...
> How do I turn off advertising SQL 2000 server name from applications like Access? I don't want the
> server name to show up in the list of available servers. Is there somewhere to turn off that
> setting?
> Thanks for your help,
> Mark|||Tibor Karaszi wrote:
> You can do this in the "Server Network Configuration" tool. Select your
> instance, the protocol in question (for instance TCP/IP), Properties,
> and the "Hide Server" checkbox.
>
Thanks, that worked. Do you know how to do this with the SQL desktop engine?|||The information is probably in the registry, so check out the registry before and after changing the
value and you'll see what key/value to modify.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Mark" <mark@.nomail.com> wrote in message news:%23DjNENmaHHA.1216@.TK2MSFTNGP03.phx.gbl...
> Tibor Karaszi wrote:
>> You can do this in the "Server Network Configuration" tool. Select your instance, the protocol in
>> question (for instance TCP/IP), Properties, and the "Hide Server" checkbox.
> Thanks, that worked. Do you know how to do this with the SQL desktop engine?

AdventureWorks_Data.mdf, where is it?

I'm using 'Using Data Grid View' in 101 samples and it wants to access the AdventureWorks_Data.mdf.

I cannot find this database anywhere, even searching the Microsoft web sites.

Does anyone know where it's located?

Thanks.
If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all
|||

Tony Scarpelli wrote:

If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all


The page cannot be found

|||Go here : http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en|||Thanks...|||

you can get it from

http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

|||

Please help,

The AdventureWorks_Data.mdf file is for SQL Server 2008. That file could not work when I tried to install it on my SQL Server 2005 Express Edition with Advanced features.

Does anyone know of the write database?

Thanks.

AdventureWorks_Data.mdf, where is it?

I'm using 'Using Data Grid View' in 101 samples and it wants to access the AdventureWorks_Data.mdf.

I cannot find this database anywhere, even searching the Microsoft web sites.

Does anyone know where it's located?

Thanks.
If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all
|||

Tony Scarpelli wrote:

If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all


The page cannot be found

|||Go here : http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en|||Thanks...|||

you can get it from

http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

|||

Please help,

The AdventureWorks_Data.mdf file is for SQL Server 2008. That file could not work when I tried to install it on my SQL Server 2005 Express Edition with Advanced features.

Does anyone know of the write database?

Thanks.

AdventureWorks_Data.mdf, where is it?

I'm using 'Using Data Grid View' in 101 samples and it wants to access the AdventureWorks_Data.mdf.

I cannot find this database anywhere, even searching the Microsoft web sites.

Does anyone know where it's located?

Thanks.
If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all
|||

Tony Scarpelli wrote:

If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all


The page cannot be found

|||Go here : http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en|||Thanks...|||

you can get it from

http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

|||

Please help,

The AdventureWorks_Data.mdf file is for SQL Server 2008. That file could not work when I tried to install it on my SQL Server 2005 Express Edition with Advanced features.

Does anyone know of the write database?

Thanks.

AdventureWorks_Data.mdf, where is it?

I'm using 'Using Data Grid View' in 101 samples and it wants to access the AdventureWorks_Data.mdf.

I cannot find this database anywhere, even searching the Microsoft web sites.

Does anyone know where it's located?

Thanks.If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all
|||

Tony Scarpelli wrote:

If anyone is interested it's at

http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all

The page cannot be found

|||Go here : http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en|||Thanks...|||

you can get it from

http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

|||

Please help,

The AdventureWorks_Data.mdf file is for SQL Server 2008. That file could not work when I tried to install it on my SQL Server 2005 Express Edition with Advanced features.

Does anyone know of the write database?

Thanks.

AdventureWorks_Data.mdf, where is it?

I'm using 'Using Data Grid View' in 101 samples and it wants to access the AdventureWorks_Data.mdf.

I cannot find this database anywhere, even searching the Microsoft web sites.

Does anyone know where it's located?

Thanks.
If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all
|||

Tony Scarpelli wrote:

If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all


The page cannot be found

|||Go here : http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en|||Thanks...|||

you can get it from

http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

|||

Please help,

The AdventureWorks_Data.mdf file is for SQL Server 2008. That file could not work when I tried to install it on my SQL Server 2005 Express Edition with Advanced features.

Does anyone know of the write database?

Thanks.

|||

I found it here:

http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004

suc6

sql

AdventureWorks_Data.mdf, where is it?

I'm using 'Using Data Grid View' in 101 samples and it wants to access the AdventureWorks_Data.mdf.

I cannot find this database anywhere, even searching the Microsoft web sites.

Does anyone know where it's located?

Thanks.
If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all
|||

Tony Scarpelli wrote:

If anyone is interested it's at http://www.microsoft.com/downloads/details.aspx?familyid=2adbc1a8-ae5c-497d-b584-eab6719300cd&displaylang=en
and it's called AdventureWorksDB.msi
CU all


The page cannot be found

|||Go here : http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en|||Thanks...|||

you can get it from

http://www.microsoft.com/downloads/details.aspx?FamilyId=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

|||

Please help,

The AdventureWorks_Data.mdf file is for SQL Server 2008. That file could not work when I tried to install it on my SQL Server 2005 Express Edition with Advanced features.

Does anyone know of the write database?

Thanks.

|||

I found it here:

http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004

suc6

Thursday, March 22, 2012

AdventureWorks Database - cannot access Database Diagrams

Hi,

When I try to access the database diagrams in AdventureWorks, I get the following message:

TITLE: Microsoft SQL Server Management Studio Express

Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.


BUTTONS:

OK

Why is this?

All advice / help apprecuated.

Thanks

hi,

after "upgrading" a database from MSDE or installing AdventureWorks database, you have to access the database properties window and set the database owner to a registered login... for upgraded dbs you have to modify the compatibility level to 90 as well..
you can then access the Diagrams window..

upgraded database should have the statistics rebuilt as well WITH FULL SCAN..

DBCC CHECKDB WITH DATA PURITY should be performed as well as upgraded database do not have the "column's level values checked" by default...

regards

Tuesday, March 20, 2012

Advantages of using SQL Server vs Oracle for Small to Mdium Size N

We currently have 8 locations around the world with Access database on a
local machine in each location. Some of these locations are in remote areas
where network or internet connectivity is not available all the time. We are
looking to discontinue the Access database and migrate to either MS SQL
Server or Oracle.
We want to have local databases in each location and when ever there is
connectivity we want to be able to update the main database in the US. What
are the advantages of using SQL Server for this purpose and how can this be
done?
Thanks
SQL Server 2000 Replication Overview
http://www.microsoft.com/sql/evaluat...eplication.asp
AMB
"ADW" wrote:

> We currently have 8 locations around the world with Access database on a
> local machine in each location. Some of these locations are in remote areas
> where network or internet connectivity is not available all the time. We are
> looking to discontinue the Access database and migrate to either MS SQL
> Server or Oracle.
> We want to have local databases in each location and when ever there is
> connectivity we want to be able to update the main database in the US. What
> are the advantages of using SQL Server for this purpose and how can this be
> done?
> Thanks
>
|||SQL Server is easier to admin if you don't plan to hire a dedicated
experienced Oracle DBA.
Its software license is also cheaper, dual core CPUs count as 1 CPU license.
SQL 2005 is just around the corner in November, you can check the June
preview.
http://www.microsoft.com/sql/2005/productinfo/ctp.mspx
http://www.microsoft.com/sql/2005/pr...5features.mspx

Advantages of using SQL Server vs Oracle for Small to Mdium Size N

We currently have 8 locations around the world with Access database on a
local machine in each location. Some of these locations are in remote areas
where network or internet connectivity is not available all the time. We are
looking to discontinue the Access database and migrate to either MS SQL
Server or Oracle.
We want to have local databases in each location and when ever there is
connectivity we want to be able to update the main database in the US. What
are the advantages of using SQL Server for this purpose and how can this be
done?
ThanksSQL Server 2000 Replication Overview
http://www.microsoft.com/sql/evaluation/features/replication.asp
AMB
"ADW" wrote:
> We currently have 8 locations around the world with Access database on a
> local machine in each location. Some of these locations are in remote areas
> where network or internet connectivity is not available all the time. We are
> looking to discontinue the Access database and migrate to either MS SQL
> Server or Oracle.
> We want to have local databases in each location and when ever there is
> connectivity we want to be able to update the main database in the US. What
> are the advantages of using SQL Server for this purpose and how can this be
> done?
> Thanks
>|||Thanks for the info, but what are the advantages of using MS SQL over Oracle?
ADW
"Alejandro Mesa" wrote:
> SQL Server 2000 Replication Overview
> http://www.microsoft.com/sql/evaluation/features/replication.asp
>
> AMB
> "ADW" wrote:
> > We currently have 8 locations around the world with Access database on a
> > local machine in each location. Some of these locations are in remote areas
> > where network or internet connectivity is not available all the time. We are
> > looking to discontinue the Access database and migrate to either MS SQL
> > Server or Oracle.
> >
> > We want to have local databases in each location and when ever there is
> > connectivity we want to be able to update the main database in the US. What
> > are the advantages of using SQL Server for this purpose and how can this be
> > done?
> >
> > Thanks
> >|||SQL Server is easier to admin if you don't plan to hire a dedicated
experienced Oracle DBA.
Its software license is also cheaper, dual core CPUs count as 1 CPU license.
SQL 2005 is just around the corner in November, you can check the June
preview.
http://www.microsoft.com/sql/2005/productinfo/ctp.mspx
http://www.microsoft.com/sql/2005/productinfo/sql2005features.mspx

Advantages of using SQL Server vs Oracle for Small to Mdium Size N

We currently have 8 locations around the world with Access database on a
local machine in each location. Some of these locations are in remote areas
where network or internet connectivity is not available all the time. We are
looking to discontinue the Access database and migrate to either MS SQL
Server or Oracle.
We want to have local databases in each location and when ever there is
connectivity we want to be able to update the main database in the US. What
are the advantages of using SQL Server for this purpose and how can this be
done?
ThanksSQL Server 2000 Replication Overview
http://www.microsoft.com/sql/evalua...replication.asp
AMB
"ADW" wrote:

> We currently have 8 locations around the world with Access database on a
> local machine in each location. Some of these locations are in remote area
s
> where network or internet connectivity is not available all the time. We a
re
> looking to discontinue the Access database and migrate to either MS SQL
> Server or Oracle.
> We want to have local databases in each location and when ever there is
> connectivity we want to be able to update the main database in the US. Wha
t
> are the advantages of using SQL Server for this purpose and how can this b
e
> done?
> Thanks
>|||SQL Server is easier to admin if you don't plan to hire a dedicated
experienced Oracle DBA.
Its software license is also cheaper, dual core CPUs count as 1 CPU license.
SQL 2005 is just around the corner in November, you can check the June
preview.
http://www.microsoft.com/sql/2005/productinfo/ctp.mspx
http://www.microsoft.com/sql/2005/p...05features.mspx

Monday, March 19, 2012

Advanced SQL tutorials in Problem/Answer format

I'd like some challenging practice with SQL; general SQL-92 or MS specific (sql server or access).
There's a million sources on the Web, but most are like reference manuals. I already have MSDN with my VS 6.0 and .Net, as well as help files for 3 different versions of Access. I'm looking for something set up more like assignments or challenges. I found a couple sites like this:
SqlZoo.net and SQLCourse.com

SqlZoo has too many mistakes and vague questions. SQLCourse is pretty good, but no advanced stuff (some multiple Joins, subqueries, calculated fields and such). I like the idea of having the same related tables that you keep solving different problems with. This is more like a real-world situation. I would think that there would be a lot of question/answer tutorials for the MS supplied sample db's (Northwind, Pubs, etc.), but I haven't found any.

These forums are full of good questions posed by people, but they always concern unfamiliar data sources and I have to slog through the posts with my slow dial-up connection. I would rather do one big download and work at the problems offline.
Any suggestions?if you want the same related tables that you keep solving different problems with, your best bet is to search for the more common databases like northwind and sakila, perhaps by throwing several of their tables names into a search

if you want advanced question/answers, i humbly offer my own (the actual articles are on the techtarget.com site)

see http://r937.com/sqlate.cfm|||Thanks. There's a lot of good questions in one spot; I can easily download a bunch of those pages. Since the questions are all at the top of the pages, I can read them without seeing the answers. You helped save me a lot of searching time. If I do find some Northwind-based question tutes, I'll post the link.
Thanks again.|||Ahh, I find I learn more than enough from here :p
Just subscribe to SQL/Access threads that you are interested in.
I've knocked up a test database purely for solving problems on here -
trying to recreate peoples problems and see if I can solve them.

It's often a really good way to learn when you're given an unfamiliar problem, because you try and break it down into a generic solution (which means you can use it again later!).

There's my 2 cents. :cool:

Sunday, March 11, 2012

Advance SQL Statement Help

I have all my website access statics logging data into a SQL table with
the following structure:
id int identity
ip nvarchar 23
referer nvarchar 512
request nvarchar 512
website nvarchar 15
bytes int
process_time int
access_time datetime
Each time a page is loaded the values are logged. So if a single user
navigates 20 pages, there are 20 records in the database.
What I want to do is generate a sql statement that will return me all
the accesses to a specific website on a given day, grouped by the ip
address and sorted by the access_time.
Ideally it would return the ip addresses in date order based on their
first entry, with the responses per ip in their date order. Therefore
if
IP 216.113.235.52 had three hits at:
12:15:29
12:15:54
12:16:03
IP 216.113.214.190 had three hits at:
12:15:25
12:15:31
12:15:48
It would return a result set like:
216.113.214.190 @. 12:15:25
216.113.214.190 @. 12:15:31
216.113.214.190 @. 12:15:48
216.113.235.52 @. 12:15:29
216.113.235.52 @. 12:15:54
216.113.235.52 @. 12:16:03
What I'm doing now must not be very efficient as it takes several
seconds to return just a small list of data (roughly 3 seconds to
return 50 or so hits).
Currently I use two queries:
Query 1:
SELECT ip FROM access_log WHERE date >= <start_date> AND date <=
<end_date> AND website LIKE '%<website>%' GROUP BY ip
OR
SELECT DISTINCT ip FROM access_log WHERE date >= <start_date> AND date
<= <end_date> AND website LIKE '%<website>%'
Either of these gives me a unique list of ips on the given day
(unfortunately they're not sorted in date order :^( )
Then with this list of unique ips, I perform a second query, looping
through the ip addresses from the first query:
SELECT * FROM access_log WHERE ip LIKE '<ip>' ORDER BY date
This gives me the users path through the website in date order.
My problems are that:
1. The things just too slow.
2. I don't have a sorted list (the first user of the day may not
necessarily be the first listed).
Is it possible to generate a single query that will return the desired
results in order?
FWIW I'm accessing the database through JDBC.
Thanks in advance.SELECT website, ip, access_time
FROM access_log
WHERE
access_time >= '20060207 00:00:00.000'
AND access_time <= '20060208 00:00:00.000'
ORDER BY website, ip, accesstime ASC
This produces a listing of websites that were access by ip's, ordered by the
access_time. If you added the request column to this query, it would also
show you the path that each ip took through the website.
I've been doing a lot of work with analyzing web access logs lately. Let me
know if this was what you were looking for; if not I'll see what else I can
come up with.
"Tom Cole" wrote:

> I have all my website access statics logging data into a SQL table with
> the following structure:
> id int identity
> ip nvarchar 23
> referer nvarchar 512
> request nvarchar 512
> website nvarchar 15
> bytes int
> process_time int
> access_time datetime
> Each time a page is loaded the values are logged. So if a single user
> navigates 20 pages, there are 20 records in the database.
> What I want to do is generate a sql statement that will return me all
> the accesses to a specific website on a given day, grouped by the ip
> address and sorted by the access_time.
> Ideally it would return the ip addresses in date order based on their
> first entry, with the responses per ip in their date order. Therefore
> if
> IP 216.113.235.52 had three hits at:
> 12:15:29
> 12:15:54
> 12:16:03
> IP 216.113.214.190 had three hits at:
> 12:15:25
> 12:15:31
> 12:15:48
> It would return a result set like:
> 216.113.214.190 @. 12:15:25
> 216.113.214.190 @. 12:15:31
> 216.113.214.190 @. 12:15:48
> 216.113.235.52 @. 12:15:29
> 216.113.235.52 @. 12:15:54
> 216.113.235.52 @. 12:16:03
> What I'm doing now must not be very efficient as it takes several
> seconds to return just a small list of data (roughly 3 seconds to
> return 50 or so hits).
> Currently I use two queries:
> Query 1:
> SELECT ip FROM access_log WHERE date >= <start_date> AND date <=
> <end_date> AND website LIKE '%<website>%' GROUP BY ip
> OR
> SELECT DISTINCT ip FROM access_log WHERE date >= <start_date> AND date
> <= <end_date> AND website LIKE '%<website>%'
> Either of these gives me a unique list of ips on the given day
> (unfortunately they're not sorted in date order :^( )
> Then with this list of unique ips, I perform a second query, looping
> through the ip addresses from the first query:
> SELECT * FROM access_log WHERE ip LIKE '<ip>' ORDER BY date
> This gives me the users path through the website in date order.
> My problems are that:
> 1. The things just too slow.
> 2. I don't have a sorted list (the first user of the day may not
> necessarily be the first listed).
> Is it possible to generate a single query that will return the desired
> results in order?
> FWIW I'm accessing the database through JDBC.
> Thanks in advance.
>

Advance Problem , Just for the expeirinces

Forbidden
You don't have permission to access /localhost:8080/sas/(S(b2vekk55equugyjebolothq0))/Main1.aspx on this server.

what is the solution ?

The issue appears to be that you don't have access to a web page, but you are posting in the wrong forum.

Thanks

Laurentiu