Skip to main content

Posts

Showing posts from 2011

What is GAC?

GAC is nothing but the folder where we have installed the shared assemblies. Still framework 2.0 it was installed in the folder C:\Windows\assembly\ The location of the GAC is changed by the framework 4.0. When installing the assemblies created by 4.0 Environment, it will install in the following folder: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MySharedAssemebly\v4.0_10.0.0.0__b03f5f7f11d50a3a\ C:\Windows\Microsoft.NET\assembly\GAC_32\CustomMarshalers\v4.0_4.0.0.0__b03f5f7f11d50a3a The assemblies created by us will be installed under the GAC_MSIL folder. GAC_MSIL contains assemblies thet are run 32 bit or 64 bit machines. GAC_32 is only for 32 bit machine assemblies. Here, MySharedAssemebly is the shared assembly name.

SQL Server: How do get only Date from Datetime?

Hi, In real time business applications, we'll meet some scenarios like this. From our UI we'll send the Date time to the SQL Server to calculate the exact number of days different between today and the date passing by us. Actually the GETDATE() function of SQL Server gives the Server's Date time in this format: 2011-01-26 11:43:13.397 The Date time sending from client UI will be like this: 2011-01-02 12:00:00.000 When we try to calculate the exact number of days different between these it'll take time too. This may be give wrong answer. In this situation we can ommit the time part of the both dates. Here I wrote one SQL Server User Defined Function to achieve this.  CREATE FUNCTION [dbo].[UFN_GetExactDate] (@InputDate DATETIME ) RETURNS DATETIME BEGIN DECLARE @OutputDate DATETIME SELECT @OutputDate= CAST ( CONVERT ( VARCHAR (25),@InputDate,101) AS DATETIME ) RETURN @OutputDate END We can use this UDF in our Stored procedures like this: SELECT [dbo].[UFN_GetExactDate