I am new to SQL server, currently using 2005, my web server using 2000, we have also 2000 installed, which has enterprise.
I would like to create a schedual for daily data download to our local server, if it is possible in 2005, or may be we can use 2000 enterprise, but I am really stuck how to set this into my system.
I am new to SQL server, currently using 2005, my web server using 2000, we have also 2000 installed, which has enterprise.
I would like to create a schedual for daily data download to our local server, if it is possible in 2005, or may be we can use 2000 enterprise, but I am really stuck how to set this into my system.
I know that SQL Server runs on Windows Server, is it possible to download data in UNIX using shell script? does SQL Server has any binary or command line client for any operating system other than Windows?
Hello friends, i would like to create an e-commerce website,for selling music,video,games and books, i also want to extend its functionality to electronic products also. the problem is ,music,books,videos and electronic goods will have different properties like author,music director,company,ISBN number,..etc,i am very confused about data base design,want to add sub categories also like light music,classical,history books,technical books etc...can anyone give suggestions?
I am working on a Project Management application, and I have two data design issues I am debating.
The key element of this app, as you might expect, is Project. The project will proceed through many phases, from Planning, to Pre-Design, Design, Bid, Construction and Post Construction. All along the way there are a number of discrete tasks that must be performed and tracked.
I bounce back and forth in my mind between a single Project table that encapsulates all of these tasks, but am hesitant because I'm not a big fan of large monolithic tables. Alternatively, I could logically create separate tables for the various phases. However, this would create a series of one-to-one relationships between Project and the Phase tables, and require extra joins. The performance hit would probably not be too bad, but I would need to add extra code in either the app code or stored procedures to create an empty record in each of the phase tables when a new project is added. (Obviously, projects in planning or design will not have active records in the Construction and Post Construction tables). What are your thoughts about these choices?
Secondly, I have to manage data for a lot of individuals, which basically break down into two groups. First are internal employees who will have tasks routed to them, be invited to meetings, etc. Second are external vendors, basically contractors and consultants, who will be performing work and also be invited to meetings and such. I need to track the participants in meetings and inspections, so will have a Meeting Participant table to capture the many-to-many relationship. My issue is structuring the handling of the people. One option is to have a Person table, which basically includes everybody, with a flag field for internal or external people, and categories for their roles. Second is a table for internal folks and a table for external, or separate tables for Consultants, Contractors, and internal Employees. However, this makes capturing the meeting participants more cumbersome.
We are starting with designing a datawarehouse for my company. I have done some reading on the concepts and steps involved, but what I am seriously lacking is some examples. I'd like to read through some real examples of data warehouses that worked including the full design diagrams. Can anyone direct me to some good sites for this?
Hi, I am new to SQL 2005. I have to design schema for scientific data warehouse. Data is available in 2 or more flat data files recorded at 1 sec interval. At Least 2 of the data files have 100+ columns. I am inclined to create a table per data file type. I want to know If this is correct/optimal for me to do?
I don't think I can create normalize tables based on the headers in these Data files.
Primary Objective of this data warehouse is make it available for reporting services and Analysis Services.
I am new to SSIS. I need some help in designing the below dataflow task.
-- Teacher creates several tasks and each task is assigned to multiple students -- The teacher table contains contains all the tasks created a every teacher use ods go create table teacher ( yr int, tid int, tname varchar(20), taskid int
)
insert into teacher values(2007,101,'suraj','task1') insert into teacher values(2007,101,'suraj','task2') insert into teacher values(2007,102,'bharat','task3')
insert into teacher values(2007,103,'paul','task4') insert into teacher values(2007,103,'paul','task5') insert into teacher values(2007,103,'paul','task6')
-- Teacher "suraj" has created 2 tasks -- Teacher "bharat" has created 1 task
select * from ods..teacher yr tid tname taskid ============================ 2007 101 suraj 1111 2007 101 suraj 1122 2007 102 bharat 2222
-- Students table contains studentid(sid),teacherid(i,e tid ) & taskid drop table students
create table students ( yr int, sid varchar(10), tid int, taskid varchar(10) )
truncate table students
insert into students values(2007,'stud1',101,'task1') insert into students values(2007,'stud1',101,'task2')
insert into students values(2007,'stud2',101,'task1') insert into students values(2007,'stud2',101,'task2')
--Note : stud1,stud2 comes under teacher with tid "101"
insert into students values(2007,'stud3',102,'task3')
-- Note : stud3 and stud4 comes under teacher with tid "102"
insert into students values(2007,'stud4',103,'task4') insert into students values(2007,'stud4',103,'task5') insert into students values(2007,'stud4',103,'task6')
insert into students values(2007,'stud5',103,'task4')
select * from students yr sid tid taskid ---------------------------- 2007 stud1 101 task1 2007 stud1 101 task2
Now in my target table i need to load the data in a such a way that
use targetdb go drop table trg go
create table trg ( yr int, -- data should load from teacher.yr tid int, taskid int(20), cnt int
)
Mapping in target column and value to be loaded ================================================== yr -- teacher.yr tid -- teacher.id taskid -- this need to start a new sequence of numbers starting from 1 for each teacher and dont want the task id to be copied as it is. cntofstudents -- need to count no of students from "students" table for a given teacher and for his assignment
For example for teacherid "101" and taskid "task1" there are 2 students again for the same teacher "101" and taskid "task2" there are 2 students
For teacher "102" and taskid "task3" there is only 1 student
Similary for teacher "103"
Relation ========
Teacher table | Students Table yr | yr tid | tid
After i run the ETL the data should look as follows :
insert into trg values(2007,101,1,2) insert into trg values(2007,101,2,2)
insert into trg values(2007,102,1,1)
insert into trg values(2007,103,1,2) -- task4 is created by teacher "103" and assigned to 2 students stud4 and stud5 insert into trg values(2007,103,2,1) -- task5 is created by teacher "103" and assigned to 1 student i.e stud4 insert into trg values(2007,103,3,1) -- task6 is created by teacher "103" and assigned to 1 student i.e stud5
Note : If u observer the values in 3rd column of the trg table, instead of directly mapping the taskid we need to generate a separate sequence for every teacher.
BottomLine : for each and every task created by each teacher there should be a unique record along with the count of students in "STUDENTS" table
Can anyone help me out in designing the Data Flow task for this Functionality.
Hi, I am new to SQL 2005. I have to design schema for scientific data warehouse. Data is available in 2 or more flat data files recorded at 1 sec interval. At Least 2 of the data files have 100+ columns. I am inclined to create a table per data file type. I want to know If this is correct/optimal for me to do?
I don't think I can create normalize tables based on the headers in these Data files.
Primary Objective of this data warehouse is make it available for reporting services and Analysis Services.
I am using a sql server 2012 and having a database "Test".In this database , having a table "Employee". I have encrypted the employe table data with the password. How can is use these employee data in oracle server. ie;How can I show the employee data as the encrypted and decrypted form of data in Oracle server( The actual encryption happened only in SQL DB).
I have data that is similar in nature to stock market data. There are about 100 entries per day. I would like to setup a second table to supply chart information. (assuming 1000 pixels per chart max)
What is the best way to condense the information in this table so that if I query for a chart, the table returns about 1000 points? I could have several tables setup, one for short term, and one or two for longer term. But I still don't know how to condense them.
I'm trying to figure out if it's good design practice to have several pieces of data in a one column. I explain by example. Let's say you build a movie site. Each movie can belong to several categories. A movie can be Action, Adventure, Fantasy and Drama all at once. Assume a database table with all the movies and another table with all the categories. Now how would I associate one movie with several categories? Would it be OK if I add a Category field in the movie table and then add several categories in that, delimited by commas? Sort of like below:
movie_title | movie_rating | category_name--------------------------------------------------------------------------------------------------Pirates of the Carribean | PG-13 | Action,Adventure,FantasyEvil Dead | Unrated | Horrorand so on ...I can then query the database with a LIKE query if I want to select all movies of a certain category. Personally, I don't like this approach to much, but I can't think of another way to achieve this. Well, there is one other, but I like that one even less. I could create another table that links each movie to a category, but his way each movie with several categories would get a new row. Using the table above, Pirates would get three rows in that table. One with Action, one with Adventure and one with Fantasy. Get my drift? It all seems counter-intuitive. Thoughts? Thanks :o)
Hello guys, I am a hobbyist programmer and now that I have started asp.net, I was wondering about the correct way to enter data into a table. For example, i have a table called players with a field called status. What should I code the status as? "Active" or "Retired" or 1 and 0? I thought using 1 and 0 would be better as far as database size, but it is pretty difficult to understand how to modify the gridview. I come from PHP and everything is a lot more accesible there as far as modification of output. Thanks in advance!
I have been asked to design a solution for a client of mine who basically requires the daily analysis and reconciliation of the differences between 2 extremely large text files.
The files are not in an identical format but are both in some form of delimited format (one is CSV, the other is a little more complex). For the sake of this question, let's assume that I can effectively import each file into an MS SQL table.
Each file will have in excess of 100,000 rows each day (new data for each day).
Whilst I know that MS SQL does easily have the capacity to store the data, is there a recommended way to tackle the potential problems (I imagine that performance is important... they will be running the report every day)
Or is building the solution as simple as importing the data into 2 tables, and then querying the differences and outputting as a report using Crystal?
I have an opportunity to rebuild a database model with the express purpose of improving query performance. So given the following I have a few questions.
Table A (~500M records) Primary Key Field (int) Field 1 (varchar) Field 2 (varchar) Field 3 (varchar) Field 4 (varchar) Field 5 (varchar)
Table B (1B+ records) Primary Key Field (int) Foreign Key Field (int) Field 1 (varchar) Field 2 (varchar) Field 3 (varchar) Field 4 (varchar) Field 5 (varchar)
* Assumed: Tables are inner joined on all queries. The database is readonly.
-- Most of my lookups are based on querying Field 1 of Table A. The data content of Field 1, Table A is 90% unique. 1) Would it be more beneficial to put the clustered index on Field 1 instead of the PK field in Table A? 2) Can an Identity column be non-clustered? 3) Alternatively, would it be beneficial to build a separate lookup table with just the PK & Field 1 of Table A, with a clustered index on the lookup table Field 1 which I join on Table A? (did that make sense?)
-- I have a secondary lookup that performs queries on Fields 1, 2, 3, 4 & 5 of Table B 1) Would it be more beneficial to create an additional indexed lookup column of the concantenated values of Fields 1-5 of Table B versus a covering index of all 5 columns? 2) Does a clustered index have to be unique? 3) Would a clustered index be more beneficial over Fields 1-5 or the special lookup column versus the PK or FK fields? 4) Would creating a special lookup table with just the requisite fields be more beneficial?
An extra question. The existing data model uses the CHAR datatype for all columns less than 9 characters wide and the columns are set to allow nulls. This requires every select statement to COALESCE() and RTRIM() all these columns. I intend to make all (affected) columns VARCHAR, NOT NULL with a default value of a 0-length string. Will this enhance query performance?
I am working on a project, which involves displaying trends of certain aggregate values over time. For example, suppose we want to display how the number of active and inactive users changed over time.
One issue is how to store historical data. First of all, should I create a separate database for each historical snapshot or should I use one database for all snapshots? Second, our database size is a couple of gigabytes and replicating the entire database on a daily basis is not feasible. An alternative solution is to back up aggregate values, but how do I back up results of aggregate queries, where the user can specify a date range in the WHERE-clause? Another solution is to create fact tables from our relational schema and back those up.
Another issue is how to query historical data. Using multiple databases to store historical snapshots makes it harder to query.
As you can see there are several design alternatives and I would like to know how this sort of problem is generally solved in the industry. Does SQL Server provide any support for solving this problem?
We currently have about 900 stored procedures which have logic to group healthcare claims into different 'Edit Groups' depending on the logic within each 'Edit' stored procedure.
Examples of the logic for the Edit stored procedures would be something like:
Edit1: Find all claims from same patient and same provider (matching on SubsriberID and ProviderID) which has a procedure code in (P1, P2, P3....P345) and a diagnosis code in (D1, D2,...D123) and does NOT have a modifer code in (M1, M2, M3)
Edit2: Find all claims from same patient and same provider (matching on SubsriberID and ProviderID) which has a procedure code in (P7, P8, P9....Pxxx) and a diagnosis code in (D1, D2,...Dyyy) and has a modifer code in (M3, M4, M7), which are dated within 120 days of each other.
Do you think one of the SQL Server 2005 Data mining algorithms (Clustering or Classification or Association Rules) could play some part in this? Most of the 900 stored procs can be grouped based on logic, I mean the logic is similar for each group and only the parameters (in brackets above) vary for each stored proc within the same group.
We're totally new to data mining, although we do have some moderately complex cubes running. Which algorithm (if any) would be the most appropriate for our needs?
I have a very large table that I am trying to partition and use to reduce maintenance overhead as well as improve performance. The table contains about 12 years worth of data but only the most recent years is inserted/updated/deleted from thru the app. I created partitions on a computed(persisted) column which holds the "year" value derived from a date column. I have created the partitions with all the default set options, and the stored procedure which performs the delete against this table also was created with no special set options(basically database/session default). Yet, every time I try to run the proc to delete data thru the app, I get this error:
Msg 1934, Level 16, State 1, Procedure xxxx, Line 118 DELETE failed because the following SET options have incorrect settings: 'ANSI_WARNINGS'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.
I've tried setting ANSI_WARNINGS on and off when creating the proc, inside the proc etc.., its always the same error whatever I set the option to.
I have a question about staging design using SSIS. Has anyone come up with an ETL design that would read table names from a generic table and dynamically create the ETL to stage the table.
1. Have a generic table which would have table name and description and whatever else that was required.
2. Have a master ETL that would enumerate through the table and stage all the table names found in the generic table.
This way I wouldn't have to create an ETL which would hardcode the names of 300-500 tables and have the appropriate 300-500 data sources and targets listed.
Not sure if I am making sense but I hope someone understands the attempt.
I have 3 tables (accnt, jobcost, and servic15). all with the same fields (code, jno, ven, date). I need to insert the data from these tables into another table called dummy with the same fields, in one statement or query.
I have recently been task with rewriting a database that holds large volumes of data, whilst ensuring that query can be run in optimal time. Having never really delved into this sort of thing before, I hoped you guys might be able to offer some advice and guidance.
The design I have inherited is based around 2 main tables:
[captured_varbinds] [id] [int] IDENTITY (1, 1) NOT NULL [captured_trap_id] [int] NOT NULL [varbind_oid] [varchar] (500) [varbind_text] [varchar (500)
The relationship between the two tables is on the "captured_traps (id)" to "captured_varbinds (captured_trap_id)". Currently the "captured_traps" table contains around 350 million rows, the "captured_varbinds" table contains around 900 million rows.
Now as you can probably gather this model runs like a....well it sort of hobbles more than runs hence the need to redesign.
My current thoughts on this are:
- Normalising all varchars - there is alot of duplicate values in most of the varchar fields. - Full Text Indexing
However beyond that I am not sure which route to go down. After googling for most of today I have come across a number of "solutions" however I do not want to go steaming down the track of one of these to discover that it is fatally flawed somewhere.
I am looking to store the different forms and data in our database. We have several different forms and contains different information. I am looking for different approaches to model this table structure.
Also, I need to make sure the table structure will allow for new forms.
I've done some basic database design in the past, but am a relative newbie to design. I have recently come across a situation I'm not sure how to handle. Here's the situation...
Assume we've got a contacts table which holds information about our contacts. All contacts have the same basic information - name, address, telephone, etc. Each contact is of a certain type - let's just say a, b, and c, for ease. This contact type is stored in the contacts table. Now, on contacts of type b, I also have to store some additional data. What it is doesn't really matter. I found a way to set this up, but I'm not sure that I'm going about it the right way, and would love some advice on the proper way to do this. Basically, what I did is create my contacts table: Contact_id, contactName, ContactAddress, ContactPhone, ContactType. Created a contacttype table ContactType, ContactTypeDescription, ContactAddInfo
What I've done is left contactaddInfo as a nullable field. When it has a value, that value is the name of a table which holds the additional information that I need for the contact... So when I'm running a query, I can tell if I need to reference another table by checking the value of ContactAddInfo.
I can't imagine that this is the best solution, but it was the first thing that popped into my head, and it's a really small database that's using it. However, I'm now being faced with the same situation in a much more important, larger database, and I'd love to know the 'right' way.
Hi to everyone,My problem is, that I'm not so quite sure, which way should I go.The user is inputing by second part application a long string (let'ssay 128 characters), which are separated by semiclon.Example:A20;BU;AC40;MA50;E;E;IC;GREENNow: each from this position, is already defined in any other table, asa separate record. These are the keys lets say. It means, a have someproperities for A20, BU, aso.Because this long inputed string, is a property of device (whih alsohas a lot of different properities) I could do two different ways ofstoring data:1. By writing, in SP, just encapsulate each of the position separatedby semicolon, and write into a different table with index of device,and the position in long stirng nearly in this way:Major device data tableID AnyData1 AnyData2 ... AnyData3123 MZD12 XX77 .... any comment text124 MZD13 XY55 ... any other commentString data Tablefk_deviceId position value123 1 A20123 2 BU123 3 AC40.....123 8 GREENThe device table, contains also a pointer (position), which mightchange, to "hglight" specified position.Then, I can very easly find all necessary data. The problem is, I needto move the device record data (from other table) very often into otherhistory table (by each update). That will mean, that I also need tomove all these records from 1 -8 for example to a separate historytable, holding the index for a history device dataset. This is a littleinconvinience in this, and in my opinion, it will use to much storagedata, and by programming, I need always to shift this properities intohistory table, whith indexes to a history table of other properities.2. Table will be build nearly in this way:Major device data tableID AnyData1 AnyData2 ... AnyData3 stringProperty pointer123 MZD12 XX77 .... any comment text A20;BU;AC40;MA50;E;E;IC;GREEN 3124 MZD13 XY55 ... any other comment A20;BU;AC40;MA50;E;E;IC;GREEN 2By writng into device table, there will be just a additional field forthis string, and I will have a function, which according to specifiedpointer, will get me the string part on the fly, while I need it.This will not require the other table, and will reduce the amout ofdata, not a lot ... but always.This solution, has a inconvinance, that it will be not so fast doing asearch over the part of this strings, while there will be no real indexon this.If I woould like to search all devices, by which the curent pointervalue is equal GREEN, then I need to use function for getting thevalue, and this one will be not indexed, means, by a lot amount ofdata, might be slow.I would like to know Your opinion about booth solutions.Also, if you might point me the other problems with any of thissolution, I might not have noticed.With Best RegardsMatik
I have below DB structure in MSSQL for a small application which follow relational approach. Data retrieval (for Hostels) will need several Join, may be Key-Value approach where data retrieval will be fast.
Ilve install sql server 2012 in my pc and i want to change datetime default format. How can i do this and please i dont want to take the result from select convert() or select cast or something like this. I ve want to take the format i want writing query select datecolumn from table.
Now the format i have is: 2015-11-16 09:04:00.000
And i want this format: 16.11.2015 09:04:00
Is any way to convert automaticaly by select only column? or can i change at all once? or must write function to when i select the column can change automatic ? or another thing, i ve see in column properties something like formula. In computed column specification in formula i wrote this:
And I take the format i want automaticaly but i get the current date for all rows and i cant edit or insert that column anymore. So, how to change the format of date time but no from select query.
I'm designing a database that stores personal details of students and teachers for a school. I, wish to know if a there is away of formatting the bit data type to male/female. Cause i am only able to achieve 0 and 1 in this data type. So is there any way to change it, or is there any other data type suitable to provide only two options Also the database should be protected in a way that students may not be able to view or change. Only teachers/admin have the right to access/modify the data.