I'm working with the sample database called Adventure Works and I'm encountering data consistency issues : If I sum the TotalDue for one particular territory, for one particular time window from the Sales. SalesOrderHeader table and if I try to compare the result to the LastYearSales and YTDSales from the Sales.SalesTerritory table, I don't get the same number, whatever I try. So did I miss something ? How are the LastYearSales and YTDSales fields from Sales.SalesTerritory calculated ?
I am new to ms SQL. I only have the use of the Enterprise Manager. Creating tables I understand. However I am confused on how to add data to a table or view the data in a table. Can this be done through Enterprise Manager? If I am adding a large amount of data do I have to use the query window. This seems like a tedious method. In Access yo have a form basically pop up where you can type in the record sets. Any advice would be appreciated! Sincerely, Bill Bequette
I'm new at this and wondering if someone would have the heart to help.I want to know how to add data into a database. Here's the details:I have a sqldatasource( sqldatasource1) attached to a database with a table named customers.The table(customers) has one field named 'Name' with datatype varchar(50)I have a textbox (textbox1) and a button (button1)I want to insert the text into textbox1 into my database. how can i do that?
We are using SQL server 7.0 as RDBMS for BaaN ERP. We have created the database file in E: drive. Now E: drive is going to be exhausted, We are trying to add a new file at different location. When we add the file into database it creates a file with default extension .ndf but previous file has the extension .mdf. should we change the extension of new file to .mdf or we should continue with default extension .ndf.
is it necessary to add a secondary file group or we add a file to the existing primary group.
We have 1 TB database and we recently got space so 1) can i add data files and put in different disk in production hours 2) what are the effects of doing this. JUst want to get expert advise
Books online mention the existence of sample code for several custom tasks, including the one mentioned in the title. But, when I try to find this code in the location mentioned it is nowhere to be found.
I have run a search on the rest of my drive and come up empty.
Im trying to use VB.net 2005 to write a sample app to access a DB. Are there any samples for this and any samples of how I go about making the DB in the first place?
I'm looking for a sample database for a big company, organization,... to build my db project as a part of my db system courses. Can anybody help me? Thanks anyway.
i have a query that uses the adventure works sample database am working on sql server 2000 can i install this sample database to this sql2000 server? Best Regards
Hi im a beginner in SQL. I installed SQL Server Express on my computer, but i didnt find any databases included. The institute where i go to learn SQL have plenty of databases, but students usually work on databases called AdventureWorks and GlobalToyz. I searched the web for these databases and found something but i still cant figure out what to do with it. So i was hoping if anybody could send me these databases with brief instructions on how to install it into SQL Server. Thanks in advance
I had installed the sample database " AdventureWorks ",but i couldn't find it in SQL Server Management Studio,and I noticed than it was installed into "Microsoft SQL Server 2005 Samples" directory,but not "Microsoft SQL Server" directory,what can I do to find the datebase. I am a beginner,and learning sqlserver by using tutorials,someone help me? many many thanks.
I install the SQL 2005 Evaluation. I selected to install samples and documentation during the installation wizard. It finished successfully but I could not find the sample databases on the SQL Management Studio. Why?
This question is for SQL Server 2000, SQL Server 2005, and SQL Server 2008.
I want to provide users a sample database with data and a database template which new databases created in an application will be based on. However, I don't want to use scripts to create database and other database objects and also don't want the data to be contained in other data store such as access database. I think about providing users with operating system files(mdf, ndf, log). My understanding is that database created thru attaching will follow the collation of the source. Is that a way to control the attaching so the database created thru attaching will follow the collation of the destination server?
If attaching is not a good way to handle my case, what are other possibilities?
Though this is not directly a SQL related question but I could not think of some other forum to post this request. <y apologies if I should have posted elsewhere...
I need some sample data for a departmental store (like WalMart of KMart) which sell a wide variety of things and probably everything under the sun :)
I need data in such a manner that we have 4-5 levels of data hierarchy. For example we can have a data hierarchy like follows:
Classification Category Sub Category Product Group Item
The above is just an example but I hope that most of you already know what I neeed. An example of data based on the following hierarchy can be as follows (shown in a tabular manner)
Classification | Category | Sub Category | Product Group | Item --------------------------------------------------------------- Household Items| Electronics| Entertainment| Audio| SONY Room entertainment box, 2 speakers 300 W each, .... Household Items| Electronics| Entertainment| Audio| Phillips Boom Box, ...specifications.... Household Items| Electronics| Entertainment| Video| SAMSUNG DVD Player model SG-17X5 ... Household Items| Electronics| Entertainment| T.V | SONG TRINTORN 51" ..... ... ...
I am needing to o exactly what Zippygoose says (with ordered ID numbers). How do yo make an insert statement that will make a loop until let's say the ID reaches 8000??
Thanks in advanced,
Edit: User needs to fill his tables with sample data. (Sorry for the edit, but I prefer to split this thread instead of continuing an old one (2003!!)).
We have 4 regions, currently we only have 3 servers in the field, and therefore only 3 regional id’s are being used to store the actual data of the pbx. The central server (RegionalID = 0) is holding the data for itself and the 4th region until the new server is deployed. It now has to be deployed and therefore the data migration for this region has to take place. I am trying to extract all the data for this 4th region (RegionalID= 1) from the central server database from all the relevant tables. When doing this I will firstly, have to check that the CallerID is valid, if it is, send that entry along with the result set, if it is not valid, Check that the dongle area code is valid, if dongle area is valid select with the result set, and if it is not valid, then check that RegionalDialup = ‘0800003554’ which is the dialup number for this 4th region (RegionalID = 1).
I have a table named lnkPBXUser which contains the following:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[lnkPBXUser]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[lnkPBXUser] GO
DDL: CREATE TABLE [dbo].[lnkPBXUser] ( [RegionalID] [int] NOT NULL , [pbxID] [decimal](18, 0) NOT NULL , [userID] [decimal](18, 0) NOT NULL ) ON [PRIMARY] GO
Sample data: INSERT INTO lnkPBXUser(RegionalID, pbxID, userID) SELECT 0, 543, 2 UNION ALL SELECT 0, 10961, 6 UNION ALL SELECT 0, 1012, 17 UNION ALL SELECT 0, 16499, 26 UNION ALL SELECT 0, 14061, 36 UNION ALL SELECT 0, 16499, 2
I have a table named tblDialupLog which has 20 columns, I have selected only the columns I am interested in (below):
PBXID DailupDT DongleAccessNum CLI RegionalID RegionalDialup 83 8/8/2006 8:58:11 AM T2 UQ 28924 0132493700 0 0800003554 543 8/8/2006 8:55:44 AM T0 UA 33902 0123623500 0 0800003554 1219 8/8/2006 8:59:03 AM T3 ZD 02031 0152958095 0 0800003554 1012 8/8/2006 9:02:54 AM T0 UA 41261 0173011050 0 0800003554 1331 8/8/2006 8:59:57 AM T0 UA 01938 0124604627 0 0800003554 1979 8/8/2006 9:02:52 AM T0 UA 09836 0163751210 0 0800003554 1903 8/8/2006 8:58:41 AM T0 UA 26009 0147175356 0 0800003554 1522 8/8/2006 8:58:54 AM T3 MB 94595 0573912871 0 0800004249 319 8/8/2006 8:51:28 AM T2 ZD 32892 0543375100 0 0800004249 3270 8/8/2006 9:04:26 AM T2 MB 87331 0 0800004249
DDL: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblDialupLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblDialupLog] GO
Sample data: INSERT INTO tblDialupLog(PBXID,DailupDT ,DongleAccessNum,CLI,RegionalID,RegionalDialup ) SELECT 83,'8/8/2006 8:58:11 AM' ,'T2 UQ 28924','0132493700',0 , '0800003554' UNION ALL SELECT 543,'8/8/2006 8:55:44 AM','T0 UA 33902','0123623500',0,'0800003554' UNION ALL SELECT 1012, '8/8/2006 9:02:54 AM', 'T0 UA 41261', '0173011050', 0 ,'0800003554' UNION ALL SELECT 1219, '8/8/2006 8:59:03 AM' ,'T3 ZD 02031', '0152958095', 0,'0800003554' UNION ALL SELECT 16499, '8/8/2006 8:51:28 AM', 'T2 ZD 32892', '0543375100', 0, '0800004249'
You see that the DongleAccessNumber is actually made up of three parts, and it is the middle part (ie.UQ) which i will use to check that the tbldongleArea.DongleAreaCode is valid for that region
I have a table named tblCodes, it contains all regions but I only need to select the codes for RegionalID 1 :
CodeID RegionalID ExtName SubsNDCD LocCD UpdateStatus RegionDesc 7973 1 PRETORIA 012 362 0 NORTH EASTERN REGION 7974 1 HARTEBEESHOEK 012 3012 0 NORTH EASTERN REGION 7975 1 HARTEBEESHOEK 012 3013 0 NORTH EASTERN REGION 7976 1 PRETORIA 017 3014 0 NORTH EASTERN REGION 7977 1 PRETORIA 012 3015 0 NORTH EASTERN REGION
DDL: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblCodes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblCodes] GO
DDL: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblDongleArea]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblDongleArea] GO
CREATE TABLE [dbo].[tblDongleArea] ( [AreaID] [int] NOT NULL , [RegionalID] [int] NULL , [DongleAreaCode] [varchar] (5) NULL , [AreaDesc] [varchar] (64) NULL , [UpdateStatus] [int] NULL ) ON [PRIMARY] GO
Sample Data: INSERT INTO tblDongleArea(AreaID,RegionalID,DongleAreaCode,AreaDesc,UpdateStatus) SELECT 12,1, 'UA', Oumashoop, 0 UNION ALL SELECT 13, 1, 'UB', 'Pietersburg', 0 UNION ALL SELECT 14, 1 ,'UC' ,'Warmbad', 0 UNION ALL SELECT 15, 1, 'UD', 'Nylstroom', 0 UNION ALL SELECT 16, 1, 'UE', 'Potgietersrus', 0 UNION ALL SELECT 27, 1, 'UF', 'Louis Trichardt', 0 UNION ALL SELECT 28, 1, 'UG', 'Messina', 0
I have a table named tblRegionalNumbers which contains the following, as you can see the RegionalDialup for the fourth region = 0800003554:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblRegionNumbers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblRegionNumbers] GO
INSERT INTO tblRegionNumbers(RegionalID ,RegionalDialup,Region,UpdateStatus,RegionCode,LocalRegion) SELECT 1,'0800003554', 'North Eastern', 0, 1, 0 UNION ALL SELECT 2, '0800005027' ,'Gauteng', 0 ,2, 0 UNION ALL SELECT 3, '0800006194','Eastern', 0, 3, 0 UNION ALL SELECT 4, '0800004249' ,'Central', 0, 4, 0 UNION ALL SELECT 5, '0800201859','Southern', 0 ,5, 0 UNION ALL SELECT 6, '0800201989' ,'Western' 0, 6, 0 UNION ALL SELECT 0, '0800113515', 'HO', 1, 0, 1 UNION ALL SELECT 8, '0800222204', 'Tellumat', 0, 7, 0
Ok, I am dealing with the lnkPBXUser table at the moment,
I need to be able to join lnkPBXUser and tblDialupLog, then compare tblDialupLog.CLI to tblCodes.SubsNDCD + tblCodes.LocCD (when these two columns are concatenated the result will only be a substring of tblDialupLog.CLI. (this is to make sure that the CLI exists in tblCodes.)
If it does exist, then it is part of the fourth region and should be returned in the result set.
If it does not exist, I then need to check that tblDongle.DongleAreaCode is a substring of tblDialupLog.DongleAccessNumber.
If it is a valid DongleAreaCode for that region, then it is part of the fourth region and should be returned in the result set.
If it does not exist, I then need to check that tblDialupLog.RegionalNumber = ‘080003554’.
So from the above tables an expected result would be:
RegionalID pbxID userID 0 1012 17 0 543 2
Please assist, it would be greatly appreciated. Regards SQLJunior
I want the sum of the last payments (amount) for all customers. The lastpayment is with one with most recent date. And if there are more than onepayment on the most recent date then the one with the higher paymentid isthe last payment. for example in the given data the insert statement thatstarts with capital I is the last payment of that customer. The correctanswer should be 2100 as given below. both queries by Erland and Anith givethe result 100 ( I removed the "WHERE p1.date <= '20030301' " Clause fromboth queries since right now I want current sum (not till some date). Sowhat should be the right query.Thanks again for the help.create table payments (paymentid int,customerid int,amount int,date datetime)insert payments values (1, 1, 100, '1/1/03')insert payments values (2, 1, 200, '2/28/03')Insert payments values (3, 1, 500, '5/15/03')insert payments values (4, 2, 400, '1/16/03')insert payments values (9, 2, 800, '4/30/03')insert payments values (5, 2, 200, '6/15/03')Insert payments values (6, 2, 900, '6/15/03')insert payments values (7, 3, 700, '3/1/03')insert payments values (10,3, 300, '7/10/03')Insert payments values (8, 3, 600, '9/1/03')insert payments values (11,4, 300, '8/1/03')insert payments values (12,4, 400, '9/10/03')Insert payments values (13,4, 100, '9/10/03')customerid lastpayment amount1 3 (on 5/15/03) 5002 6 (on 6/15/03) 9003 8 (on 9/1/03) 6004 13 (on 9/10/03) 100========Result => 2100
hi, i am bit new in the field of data warehousing and data mining but catching up fast. I am in the last year of BS(Computer Science) and intend to do a project on a Business Intelligence but i was wondering can i get a sample dummy data for my work is that any way possible??
hi, i learn by practice and i would like an asp code using c# that connects to sql database can retrives information from a table. can you please copy paste me some code or give me exact link a?
I need a database file for a bank with info like customers, transactions and other bank stuff etc. It is for a university assignment. basically I just need to analyse, mine the data etc the info in the database
I have looked on msdn but none of they're databases are for a banking scenario.
Does anyone know of a sample bank database anywhere or does someone have one they could give to me ?
to download AdventureWorksDB.msi. Once I save that to my local machine I run the install and it completes with no errors. Unfortunately, I can't see any of the data in SQL Server Management Studio Express. I'm new to SQL Server Express so maybe its me, but I get the feeling that it was never added to the database. I'm still looking for SQLServerExpressSamplesOverview.htm to see if I am missing a step but I can't find it anywhere.
The install seems to have extracted database files but if I need to run some scripts by hand to create the database I don't know which order to run them in.
Hello, I am very new to SQL Server. I have downloaded the SQL Server 2005 Express from microsoft's website and installed it on Windows Vista. I have also downlaoded the sample databases like pubs, northwind from http://www.microsoft.com/downloads/details.aspx?FamilyId=06616212-0356-46A0-8DA2-EEBC53A68034&displaylang=en and adventure works from the respective site. When i try to run the script of pubs and northwind, it generates error messages and it is as follows: Msg 911, Level 16, State 1, Line 2 Could not locate entry in sysdatabases for database 'pubs'. No entry found with that name. Make sure that the name is entered correctly. Msg 262, Level 14, State 4, Procedure sp_dboption, Line 0 SHOWPLAN permission denied in database 'master'. Msg 262, Level 14, State 4, Procedure sp_addtype, Line 0 SHOWPLAN permission denied in database 'master'. Msg 2715, Level 16, State 7, Line 2 Column, parameter, or variable #1: Cannot find data type id. Msg 2715, Level 16, State 7, Line 2 Column, parameter, or variable #1: Cannot find data type tid. Msg 2715, Level 16, State 7, Line 2 Column, parameter, or variable #1: Cannot find data type id. Msg 2715, Level 16, State 7, Line 2 Column, parameter, or variable #6: Cannot find data type tid. Msg 2715, Level 16, State 7, Line 2 Column, parameter, or variable #1: Cannot find data type tid. Msg 2715, Level 16, State 7, Line 2 Column, parameter, or variable #1: Cannot find data type empid. Msg 8197, Level 16, State 4, Procedure employee_insupd, Line 2 The object 'employee' does not exist or is invalid for this operation. Msg 208, Level 16, State 1, Line 2 Invalid object name 'authors'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'publishers'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'pub_info'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'titles'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'titleauthor'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'stores'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'sales'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'roysched'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'discounts'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'jobs'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'employee'. Msg 208, Level 16, State 1, Line 2 Invalid object name 'employee'. Msg 208, Level 16, State 1, Procedure titleview, Line 4 Invalid object name 'authors'.
I think thess errors are mostly due to windows vista's new security features at the user level. However, I using my home computer and the admin privileges and in this case I shouldn't have any problem running it unless there's anything to be done on vista to work this. I'll appreciate if anyone helps me installing the sample files. Thanks in advance.
Regarding the code/db from the REAL project that just got released, I have no problem attaching the "REAL Sample V6" database, but the "REAL Warehouse Sample V6" database requires ENTERPRISE edition, because the default copy uses Partitioning (i.e. the PT version, although the document stated that the multi-table (MT) version is the default). I only have the STANDARD edition of SQL 2005, is there a workaround?
SQL Server 2000Is there any way to take sample data in my database and create an INSERT INTO script?I have a commercial application that I would like to include sample data, and instead of restoring a backup like I am doing now, I would like to first run a script that creates the database, stored procedures, etc, then run a script that inserts sample data if the customer so chooses.I know I can do this manually, but is there any way to create the script based on exisiting data?TIA-- Tim Morrison--------------------------------------------------------------------------------Vehicle Web Studio - The easiest way to create and maintain your vehicle related website.http://www.vehiclewebstudio.com
I'm looking for sample database for data mining in SQL Server 2005. In my project I need to use all algorithms provided by SQL Server 2005. I know that we have "SQL Server 2005 Samples and Sample Databases" on microsoft.com site, but there are only AdventureWorks data sets. I need sth less popular, but similar.
I have found http://www.kdnuggets.com/datasets/index.html and others, but I don't see data sets good for multidimensional analysis.
The origin of data may be natural or artificial, it doesn't matter. I don't have to generate my own data, because I had to discover new knowledge, that will be surprising to me.