Format two decimal places. Remove the SQL statement from Saturday and use the memory stream for deep copy.

Source: Internet
Author: User
Code
Two decimal places
M. tostring ("0.00 "));

-- Remove Sunday when the date is subtracted, and get the date minus days
Declare @ x datetime, @ Y datetime
Set @ x = '2017-7-1'
Set @ Y = '2017-7-31'
Set datefirst 1
If datepart (DW, @ X) <> 7
Begin
Select datediff (day, @ X, @ Y)-datediff (Week, @ X, @ Y)
End
Else
Begin
Select datediff (day, @ X, @ Y)-datediff (Week, @ X, @ Y)-1
End

The memory stream is used for deep copy, but [serializable] must be added to OBJ.
Public static object deepcopy (Object OBJ)
{
Memorystream MS = new memorystream ();
Binaryformatter BF = new binaryformatter ();
BF. serialize (MS, OBJ );
 
Object retval;
Ms. Seek (0, seekorigin. Begin );
Retval = BF. deserialize (MS );
Ms. Close ();
Return retval;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.