Showing posts with label examples. Show all posts
Showing posts with label examples. Show all posts

Friday, March 23, 2012

how create a installation for a database

how i can create a installation for my server database like the installation of examples northwind

I ask for how i can deploy my database

thanks

Your question is not very clear.

If you are asking how to install and setup SQL Server, then which version do you have in mind? See this link for version differences:

SQL Server 2005 Features, Version Comparison
http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx

If you need specifc assistance in installing SQL Server, this might help:

SQL Server 2005 Express –Installation Details
http://msdn2.microsoft.com/en-us/library/ms143441.aspx

SQL Server 2005 Express Overview
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sseoverview.asp
http://www.pcw.co.uk/personal-computer-world/software/2155087/review-microsoft-sql-server

If you need other information, please try to be more specific in your question so that we can best help you.

Thanks

|||

hi,

you can go with different techniques... you can just "copy" you database's files (data file(s) and transaction log file(s)) into the end-user machine and attach those databases as explained in many articles, and the very same is valid for restoring a prepared database backup onto the end-user machine...

personally I do prefer another approach, similar to the one presented in a great article, where you only deploy DDL schema scripts, DML INSERT/UPDATE scripts.. personally I add plain tex file to be bulk inserted as well for pre-populated table, but the concept is the same..
this method grants you the possibility to maintain your database scripts under source code control, so that your entire production/deployment phase can be verified... better, it grants you the metadata management/upgrade path you will incur with (and it will soon or later ) so that you'll not have to warry abour how to deploy these changes... it also grants you that end-users created databases inherit instance's properties form your customer's specs and not your own, as those db will use the end-user's model database.

all these are "free" ways to do it.. but you can even rely on third party tools, this one is able to produce a self-installing exe, that's to say, once running, it will install new database(s) and even update existing one(s) to the desired metadata schema..

again, personally I go for the "scripts" solution..

regards

Monday, March 12, 2012

How can we trust Outer Joins

In the future =* or *= will not be suportted but I found more then one examples that show outer join does not bring all the rows =* does.

Can any one tell me what is wrong? Market table has 19 markets Budget table has rows for BudgetYear=2006 but none for 2007

BTW the same is true in SQL2005 and 2000

-

SELECT Market_code, Description,
Revenue = SUM( CASE WHEN BudgetType = 'B' THEN BudgetAmount ELSE 0 END ),
CM = SUM( CASE WHEN BudgetType = 'C' THEN BudgetAmount ELSE 0 END ),
Tooling = SUM( CASE WHEN BudgetType = 'T' THEN BudgetAmount ELSE 0 END )
FROM Budget RIGHT OUTER JOIN Market ON Budget.Customer_Market_code = Market.Market_code
Where Budget.BudgetYear=2007 or Budget.BudgetYear is null
GROUP BY Market_code, Description
ORDER BY Description

-- GIVES only 12 results -

SELECT Market_code, Description,
Revenue = SUM( CASE WHEN BudgetType = 'B' THEN BudgetAmount ELSE 0 END ),
CM = SUM( CASE WHEN BudgetType = 'C' THEN BudgetAmount ELSE 0 END ),
Tooling = SUM( CASE WHEN BudgetType = 'T' THEN BudgetAmount ELSE 0 END )
FROM Budget, Market
Where Budget.Customer_Market_code =* Market.Market_code
AND Budget.BudgetYear=2007
GROUP BY Market_code, Description
ORDER BY Description

-- GIVES 19 results -the true

? You're falling into what some call the "trap" of the outer join... Putting predicates in the WHERE clause vs. the JOIN clause has a different logical meaning when working with outer joins. Keep in mind that the join expression is logically evaluated before the WHERE clause. With that in mind, it's a simple move: SELECT Market_code, Description,Revenue = SUM( CASE WHEN BudgetType = 'B' THEN BudgetAmount ELSE 0 END ),CM = SUM( CASE WHEN BudgetType = 'C' THEN BudgetAmount ELSE 0 END ),Tooling = SUM( CASE WHEN BudgetType = 'T' THEN BudgetAmount ELSE 0 END )FROM Budget RIGHT OUTER JOIN Market ON Budget.Customer_Market_code = Market.Market_code AND Budget.BudgetYear=2007GROUP BY Market_code, DescriptionORDER BY Description -- Adam MachanicPro SQL Server 2005, available nowhttp://www..apress.com/book/bookDisplay.html?bID=457-- <Ofer Gal@.discussions.microsoft.com> wrote in message news:641c616b-1b8a-4316-9278-f52db877ae74@.discussions.microsoft.com... In the future =* or *= will not be suportted but I found more then one examples that show outer join does not bring all the rows =* does. Can any one tell me what is wrong? Market table has 19 markets Budget table has rows for BudgetYear=2006 but none for 2007 BTW the same is true in SQL2005 and 2000 - SELECT Market_code, Description,Revenue = SUM( CASE WHEN BudgetType = 'B' THEN BudgetAmount ELSE 0 END ),CM = SUM( CASE WHEN BudgetType = 'C' THEN BudgetAmount ELSE 0 END ),Tooling = SUM( CASE WHEN BudgetType = 'T' THEN BudgetAmount ELSE 0 END )FROM Budget RIGHT OUTER JOIN Market ON Budget.Customer_Market_code = Market.Market_codeWhere Budget.BudgetYear=2007 or Budget.BudgetYear is nullGROUP BY Market_code, DescriptionORDER BY Description -- GIVES only 12 results - SELECT Market_code, Description,Revenue = SUM( CASE WHEN BudgetType = 'B' THEN BudgetAmount ELSE 0 END ),CM = SUM( CASE WHEN BudgetType = 'C' THEN BudgetAmount ELSE 0 END ),Tooling = SUM( CASE WHEN BudgetType = 'T' THEN BudgetAmount ELSE 0 END )FROM Budget, Market Where Budget.Customer_Market_code =* Market.Market_codeAND Budget.BudgetYear=2007GROUP BY Market_code, DescriptionORDER BY Description -- GIVES 19 results -the true|||when ther outer table does not meet the requirements of the JOIN clause, the values of all its' columns is NULL, thus, any further filtering (other then null-check) on those will cause the row to be removed from the result.