Schedule Representation
Sep 14, 2004
Kinda general question -but before I embark on my own design I thought I ask around. . .
What I want to design is database representation of a schedule of a roster. For instance a school roster. I hope I am not being too general here.
View 1 Replies
ADVERTISEMENT
Jul 23, 2005
My company is working on a bond derivative portfolio analysis tool andwe're facing a problem that I did not see adequately addressed anywhere in literature. I really did RTFM. I'm very experienced inrelational modelling (10+ years) so this is not a case of notunderstanding the principles. Here is the problem stripped ofirrelevant context. The problem below is simplified for the sake of theexample so don't sweat the details.THE PROBLEM1. There are many types of bonds, each type has a different set ofattributes, different attribute names, different attribute datatypes.For example, bond A has two variables: a yearly interest rate anddate of issue, B has five variables: an interest rate and 4 specificdates on which various portions of principal need to be paid, bond Chas a set of 4 variables: interest rate in period 1, interest rate inperiod 2, the date on which the bond can be put back to the issuer,and two dates on which the bond can be called by the issue. And so on.So, on the first attempt I could represent each bond type as its owntable. For example,create table bond_type_a (rate INTEGER, issue_date DATE)create table bond_type_b (rate INTEGER, principle_date1 DATE,principle_date2 DATE, principle_date3 DATE, principle_date4 DATE)create table bond_type_c (rate1 INTEGER, rate2 INTEGER, put_date DATE,call_date DATE)This is the nice relational approach but it does not work because:2. There are many thousands of bond types thus we would have to havemany thousands of tables which is bad.3. The client needs to be able construct the bond types on the flythrough the UI and add it to the system. Obviously, it would be bad ifeach new type of bond created in the UI resulted in a new table.4. When a user loads the bond portfolio it needs to be very fast. Inthe table per type approach if a user has a 100 different types if bondin the portfolio you would have to do 100 joins. This is a heavilymulti user environment so it's a non-starter. It's impossibly slow.THE SOLUTIONSSo now that we ditched the table per bond type approach we can considerthe followiing solutions (unpleasant from the relational point ofview):1. Name-Value pairs.create table bonds (bond_id INTEGER, bond_type INTEGER, attribute_idINTEGER, value VARCHAR(255))Comment: The client does not like this approach because they want torun various kinds of reports and thus they doe not want the values tobe stored as VARCHAR. They want the DB to enforce the datatype.2. Typed Name-Value pairs.create table bonds (bond_id INTEGER, bond_type INTEGER, attribute_idINTEGER, int_val INTEGER, string_val VARCHAR(255), date_val DATE_Comment: The client does not like this because the table is sparse.Every row has two empty fields.3. Link table with table per data type.create table bonds (bond_id INTEGER)create table bond_int_data (bond_id INTEGER REFERENCES bonds(bond_id),value INTEGER)create table bond_string_data (bond_id INTEGER REFERENCESbonds(bond_id), value VARCHAR(255))create table bond_date_data (bond_id INTEGER REFERENCES bonds(bond_id),value DATE)Comment: This meets most of the requirements but it just looks ugly.4. Dynamic Mappingcreate table (bond_id INTEGER, int_val1 INTEGER, int_val2 INTEGER,date_val1 DATE, date_val2 DATE, string_val1 VARCHAR(255), string_val2VARCHAR(255))Then you have to add some dynamic mapping in your code which willprovide bond specific mapping (say, stored in an XML file). Forexample,For bond_A: yearly_rate maps to int_val1, issue_date maps to date_val1For bond_C: rate1 maps to int_val1, rate2 maps to int_val2, put_datemaps to date_val1, call_date maps to date_val2)Comment: This is very good for performance because when I load aportfolio of different bond types I can pull them all in in one SELECTstatement. However this approach has a problem that the table issparse. The number of fields of each type has to be as high as toaccmodate the most complex bond while simple bonds will only be usingtwo or three.THE QUESTIONS:Are the four approaches I described above exhaustive? Are there anyother that I overlooked?
View 12 Replies
View Related
Jul 20, 2005
Hi,I want to get the string representation of a hex number from avarBinary column of a table.For example I want to get the output : 'The Hex value is 0xFF'butselect 'The Hex value is ' + convert(varchar(10), 0xFF)retruns the ascii charecter for 0xFFAny idea how do I get the hex form as it is?thanks.Supratim
View 2 Replies
View Related
Feb 25, 2007
In MS Access, for numeric fields, the decimal places shown can be defined as "Auto" meaning that the database will determine the number of decimal places to show based on the content of the field (i.e. 1.0, 0.75, 1.125).
In SQL Server for the same field, it appears that decimal precision is hard coded resulting in a fixed representation (i.e. 1.000, 0.750, 1.125)
Is there a way to make the decimal representation in SQL Server more like Access where trailing zeros are truncated?
View 3 Replies
View Related
Aug 15, 2007
Hi,
Is it possible to get the month name with only an integer representation of the number.
i.e January ,February..... the DATENAME only takes a date as a value.
thanks in advance
View 7 Replies
View Related
Nov 10, 2006
I am trying to take a hexadecimal representation of a binary number and convert to the true binary representation so that I can compare it against a binary field in one of my tables.
After reading the documentation it seems I should be able to do this with the CAST or CONVERT function. However it does not appear to be working correctly.
Can you tell me why this T-SQL code produces the wrong binary value:
DECLARE @value binary(16)
SELECT @value = CONVERT(binary, '0764DE49749F274EB924E1552FFE09EC')
PRINT @value
This prints out: 0x30373634444534393734394632373445
That is not correct it should be: 0x0764DE49749F274EB924E1552FFE09EC
Thanks
View 11 Replies
View Related
Jan 29, 2008
Hi,
Here is my sample table creation and insertion script.
I want represent as a summary-result using just one record.
How can I ?
Please note the below red color text.
create table policy
(
id int not null,
name nvarchar(50) not null,
constraint pk_policy primary key(id)
);
create table localhost
(
policy_id int not null,
id int not null,
ip_begin binary(4) not null,
ip_end binary(4) not null,
prefix tinyint not null default 0,
constraint pk_localhost primary key(policy_id,id)
);
create table remotehost
(
policy_id int not null,
id int not null,
ip_begin binary(4) not null,
ip_end binary(4) not null,
prefix tinyint not null default 0,
constraint pk_remotehost primary key(policy_id,id)
);
create table rate
(
policy_id int not null,
inbound int not null,
outbound int not null,
constraint pk_rate primary key(policy_id)
);
-------------
insert into policy values(0,N'policy0');
insert into localhost values(0,0,0xC0A80101,0xC0A80101,24);
insert into localhost values(0,1,0xC0A80A01,0xC0A80B01,0);
insert into remotehost values(0,0,0xACA80101,0xACA80101,0);
insert into remotehost values(0,1,0xACA80A01,0xACA80B01,0);
insert into remotehost values(0,2,0xACA80C01,0xACA80C01,24);
insert into rate values(0,1000,2000);
-------------
select * from policy;
select * from localhost;
select * from remotehost;
select * from rate;
-- result of policy table
0 policy0
-- result of localhost table
0 0 0xC0A80101 0xC0A80101 24
0 1 0xC0A80A01 0xC0A80B01 0
-- result of remotehost table
0 0 0xACA80101 0xACA80101 0
0 2 0xACA80C01 0xACA80C01 24
-- result of rate table
0 1000 2000
------------------------------------------------------
desired result set
id name localhost remotehost rate
-- ---------- ---------------------------------------------------------------- ------------------------------------------- -----------------
0 policy0 (192.168.1.1/24),(192.168.10.1~192.168.11.1) (172.168.1.1),(172.168.12.1/24) 0,1000,2000
descriptin of desired result set :
0. key value is id column and is referenced by each policy_id column.
1. id and name column is the same as policy table's.
2. localhost and remotehost columns are intigration of ip_begin,ip_end,prefix.
3. ip_begin and ip_end should be converted dotted presention from numeric format.
4. if prefix greater than 0, it should be displayed using '/'.
5. if ip_begin and ip_end are equal, show just one ip.
6. if the two ips are different from each other, they separated by '~'.
7. rate field is packed divided by ','.
View 4 Replies
View Related
Jul 20, 2005
Our customer (of our ecommerce system) wants to be able to preservedeleted entities in the database so that they can do reporting,auditing etc.The system is quite complex where each end user can belong to multipleinstitutional affiliations (which can purchase on behalf of the user).The end user also has a rich trail of past transactions affiliationsetc. Thus in the schema each user entity is related to many otherswhich in turn relate to yet others and so on.In the past when a user was deleted all of his complex relationshipswere also deleted in a cascading fashion. But now the customer wantsus to add a "deleted" flag to each user so that a user is never_really_ deleted but instead his "deleted" flag is set to true. Thesystem subsequently behaves as if the user did not exist but thecustomer can still do reports on deleted users.I pointed out that it is not as simple as that because the user entityis related to many, many others so we would have to add this "deleted"flag to every relationship and every other entity and thus have"deleted" past purchases, "deleted" affiliations - a whole shadowschema full of such ghost entities. This would overtime degradeperformance since now each query in the system has to add a clause:"where deleted = 0".I assume this is a standard problem since many organizations must havethis need of preserving deleted records (for legal or other reasons).I tried to talk them into creating a simple audit file where all thedeletions will be recorded in XML but they were not too happy withthat.Is there a more satisfying solution to this than have this "deleted"flag?Thanks for your help,- robert
View 9 Replies
View Related
Apr 25, 2008
SQL/SERVER 2000:
Data transform task which copies data from a text file to a db table.
Text file field value = 0000000242E (signed decimal)
DB column data type = decimal(11,2)
How do I get this value correctly converted? Getting "invalid data value" error message.
thanks for any help
View 1 Replies
View Related
May 13, 2015
I have a scenario like below
Product1
Product2 Product3
Product4 Product5
Product1 1
1 0 0
1
Product2 1
1 0 0
1
Product3 0
0 1 1
0
Product4 0
0 1 1
0
Product5 1
1 0 0
1
How to design tables in SQL Server for the above.
View 2 Replies
View Related
Jan 25, 2008
http://msdn2.microsoft.com/en-us/library/aa177009(SQL.80).aspx
i need to schedule asp code execution using SQL Stored Procedure ...im not allowed to connect using Enterprise Manager is it possible in ASP and in case how?
View 1 Replies
View Related
Jun 17, 2008
Hi all,
I want to make a job schedular in SQLServer 2005. That is i want to send email to users daily at 12:00 PM.
how can i schedule using SQLServer Agent in SQLServer 2005. And i want to filter the users from user table. Please help me
Thanks!
View 1 Replies
View Related
Jul 17, 2001
Hello,
I would like to schedule a job every 30 sec. The min time in job schedule is it allows 1 min. Is there a way I could run the job every 30 sec.
Thanks
Moin
View 3 Replies
View Related
Jul 20, 2000
How Do I schedule Sql server Jobs in interval of Seconds in place on minute/Hours? Is it possible in Sql Server?
Thanks..
View 1 Replies
View Related
Dec 11, 2000
Hi
I have lots of DTS Packages that I am running manually daily and I am trying to create schedule all of those and all of them are failing. Some of those are accross domians,but the owner on both domains have same userId and password.
Any Idea why this is failing would be really helpful
thanks in Advance
taapas
View 1 Replies
View Related
Jan 17, 2002
Hi
I would like to import data via DTS from one db to another to run every half hour.What would be the easier way to do this?Should I setup a job to run every half hour?
If anyone could help with some suggestions , it would be appreciated.
View 1 Replies
View Related
Jun 21, 2001
When I try to schedule a DTS package which is an EXE it doesn't run.
If I just run the DTS package it works fine.
I have checked the permissions of the DTS scheduled package and made sure
it had proper rights. SQL Server Services were started with the proper security rights.
When I schedule the DTS package, it is being done on the Server, and not a workstation.
Any ideas on why it will not run?...
Also, How do you schedule and EXE under SQL Server Agent Jobs.
Even when I schedule an EXE that is not a DTS package it doesn't run...
Thanks,
Daniel
View 1 Replies
View Related
Jun 19, 2008
Can any one tell me how to schedule a job using sql query
View 2 Replies
View Related
Sep 27, 2006
is there a way to make a job schedule that running store procedure for msql express ?
i'd like to make a time counter that will update every minute.
thanks
View 1 Replies
View Related
Mar 16, 2007
I have almost completed a full project by myself which is soooo exciting. The last thing I need to do is schedule a job to run the query on a specific day and time. So how do I do this? It asks me for a command and I am not sure what I am supposed to enter in here.
The Yak Village Idiot
View 7 Replies
View Related
Jun 5, 2007
How could I get an sp to run every morning at 1.00am. It would delete empty entries from a sql database.
Thx
View 2 Replies
View Related
Nov 1, 2007
Im trying to schedule a DTS package that I have created. When I right click on the package in Enterprise Manager and click on "Schedule" I get the options to set up the job to run on a schedule.
I fill out the time and click "OK". But when I immediately right click on the package again, all my settings are gone, and the defaults are back in place.
How do I know if the package will run- or if it did run?
I would actually prefer to run the job from a command line using a Scheduled Task... What would the syntax be? My DTS Local Package is named "IMPORT_DAILY_UPDATE"
Thanks
View 2 Replies
View Related
Nov 8, 2007
on ss2k5, how do you find out if sql job schedule is enable using QA?
http://www.sqlserverstudy.com
View 5 Replies
View Related
Jul 20, 2007
How is it possible to schedule a SSIS package to run at a certain time please?
View 13 Replies
View Related
Jan 9, 2008
Hi all,
I create a new in SQL Server Agent. However, When I click start Job at step, the first step start immediately,not the schedule I set. So How can do I make it to run at the schedule time?
Thank you
View 7 Replies
View Related
Mar 5, 2004
I have MS SQL installed on my workstation at work. I am trying to use DTS to export data from our local network that uses a Pervasive DB to our web server that is hosted with another company.
If I go in and manually execute the DTS package from my workstation, it send the data to the web server.
If I try to schedule the DTS Package to automatically send the data, it fails. SQL Server Agent is running on my workstation and on the web server.
Is what I am trying to do possible? What am I doing wrong?
View 1 Replies
View Related
Aug 2, 2005
I want to create a job to run once a week in sql server agent jobs. Setting up the the job to run is no problem. I want the job to run a sql statement that will retrieve sql. I then want the records to be inserted in a txt file. What is the best way to accomplish this.
View 2 Replies
View Related
Nov 4, 2005
anyone ever encountered this....i have a package which will execute fine manually but when i try to schedule it, it fails immediately (within the first second).i can even right click on the scheduled package and do "generate sql script" and then run that script and again, no problem. it just will NOT schedule.any ideas?
View 3 Replies
View Related
Mar 19, 2001
Hi All
I'm having problems scheduling a DTS package.
The server is SQL 7 sp2 running on NT4 sp5. The only other twist is that it's at a remote site that I connect to via NT Dial-up.
When I choose the 'Schedule Package...' menu option I get the normal dialog to set frequency etc... but the job isn't created.
Any guidence at all would be most appreciated.
Thanks
Phill
View 1 Replies
View Related
Mar 23, 2000
I create DTS package and when I want to schedule the package an error occures. The message says :
Microsoft SQL-DMO
Connection user failure (null)
Non associate to a secured SQL server link
Do you know what happened ?
View 1 Replies
View Related
Oct 19, 1999
Hello and thanks for reading my post...
I have a DTS package that I can execute manually all I want, no problem.
However, when I try to schedule the package to run as a job, it error when it tries to connect to my remote database, giving me comments about the ODBC driver (which is installed correctly).
My best guess is that when I run it manually, it running under my userid/password (NT authentication), but when it runs as a job, it is using the SQL Agent, which has a different level of authority somehow.
This may be a no-brainer, but I've looked at everything I know of.
Please help!
View 4 Replies
View Related
Feb 2, 2000
is it posible to change a file name usinging schedule task??
I used this syntax
Exec xp_cmdshell "REN
E:Elsie_DB_db_dump*.* E:Elsie_DB"
Is there another way of doing it??
View 3 Replies
View Related
Mar 25, 2003
Hi,
I have 2 jobs schedule to run after every alternate hour. Job A runs at 1 am, 3 am, 5 am etc. and job B runs at 2 am, 4 am , 6 am.
If job A is still running I would like Job B not to start at the scheduled time. How can I achieve this?
Thanks in Advance .... j
View 3 Replies
View Related