SQL Server – Applying business logic using CHECK type constraint

Our client is in the business of fabricating soap. One feature of our accounting suite is keeping track of all their cooking sessions (they have a production line dedicated for that and it is called kettle).

A database table called ProductLineForm handles immediate data for each session.

A session can be NOT STARTED, STARTED and ENDED. Two columns StartDate and EndDate of type DATETIME must always be of valid values all the time.

NOT STARTED should have both start and end dates to have the SQL minimum date value.

STARTED should have its end date still using the minimum value while the start date will get the started date.

ENDED must be that the start date is always equal or earlier than the end date.

I need to implement this rule to the table. Here is the check constraint applied.

ALTER TABLE ProductLineForm
ADD CONSTRAINT ProductLineForm__Date__Rule
CHECK
(
(DATEDIFF(d,StartDate,’1753-01-01′) = 0 AND DATEDIFF(d,EndDate,’1753-01-01′)=0)
OR (DATEDIFF(d,’1753-01-01′, StartDate) > 0 AND DATEDIFF(d,EndDate,’1753-01-01′)=0)
OR DATEDIFF(d, StartDate, EndDate) >= 0
)

 

 

 

 

 

SQL Server Express Reporting Services and MYSQL

A freelancer would be having second thoughts of developing an SME database under a SQL Server Standard edition or above.

Looked up for the standard edition’s license price and it could cost thousands of dollars. I think it is around $3,000.00 – $6,000.00.

I would rather use MYSQL.

Still you can keep using some of the important features of SQL Server. Reporting services is available on express license.

I have hours researching on how to still use and connect Reporting Services to MYSQL under the express license. Creating a linked server connection is the only way for you to connect SSRS express to MYSQL.

If you are planning to use the ODBC connection directly from the report then it will not allow it.

SSRS Express only allows SQL Server connections. So again you have to use linked servers.

Free Exams at Upwork.com!!!

Just create an account at upwork.com and enjoy the amenities.

Just took the “C# Test” under test category “.NET Technologies”. It says in the test topics that it will cover items in Microsoft 70-483 Exam as well. Some questions made me look unprepared. But I still managed to pass it.

This reaffirms the need to read preparatory books for 70-483 other than Wiley’s.

Score : 3.25 out of 5 – Above Average

https://www.upwork.com/o/profiles/users/_~01baad437206fe4f5f/

Better constructor, adding listviewitem object to listview.items collection

Sharing to you a simpler way to add a listviewitem object compared to creating an instance from the items.Add() method and adding subitems to the instance until the columns are completed.

ListViewItem item = new ListViewItem(new string[13] {
entity.ItemID.ToString(),
entity.Name.ToUpper(),
entity.Description,
entity.Code,
entity.Remarks,
entity.Size,
CommonFunctions.ReformatToDecimal(entity.Stock, Globals.SystemSetting.InventoryDecimalDigit),
CommonFunctions.ReformatToDecimal(entity.SellingPriceBeforeVAT, Globals.SystemSetting.InventoryDecimalDigit),
CommonFunctions.ReformatToDecimal(entity.MovingCost, Globals.SystemSetting.InventoryDecimalDigit),
brandName,
location,
entity.ItemUnit.ItemUnitName,
CommonFunctions.ConvertBoolToEnglish(entity.Active)});

item.Tag = entity;
listViewItem.Items.Add(item);

 

Just pass an array of strings to the constructor.

70-483 Certification and practice what you have learned.

I am very close to taking 70-483 Microsoft certification. But before taking this 1 hour plus exam I’d like to put what I have learned to practice. I have read one book from Wiley’s for the second time. Planning to read it for the third time. Microsoft publications also has a book for it and I will try to read it as well.

I will be trying to optimize a class library project. That project was meant for pushing XML to a database table(s) in SQL Server. This is a class library owned by my employer. The class library is being injected daily by a windows service. We built a windows forms project to access the class library from a GUI. The XML can be as heavy as 4MB so that’s a lot of instances to insert.

Everything to be practiced is only limited to C# therefore I will try to do

a. profiling and custom text listeners. These are included in the exam.

b. and others I can think of

The goal is to make the class library quicker so readers should expect a before and after comparison chart in the end. I am a new blogger. I will try to make things informative. I hope to be criticized.