SQL Server

Show images on Grid View from File Stream

Background : In my last post about SQL Server 2008 new feature File Stream (Saving and Retrieving File Using FileStream SQL Server 2008), we did an example of saving an image to the file stream and then retrieve it back and make it available for download. The result of that example looks like as below. But, one has to press the button to download the image file. One of my blog reader raise a point that he wants to display the same image instead of Get File button which is going to download. Introduction...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Get Column name From Stored Procedure

The requirement of the day is to extract the name of the columns returned by procedures. Stored Procedures are dynamic that is why we need to create a function that takes Stored Procedure name as parameter and return the column names in string. So here is the quick snippet for that 1: Public Shared Function getMetaData(ByVal spName As String) As String() 2: Dim sqlCon As New SqlConnection(Configuration... 3: sqlCon.Open() 4: 5: Dim sqlCmd As New...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Configure SQL Server 2008 for File Stream

Well, from past two days I am working on SQL Server 2008 new feature called File Stream. In the period of SQL Server 2005 when we want to store some files to the database we can have that using varbinary(max) but that approach is not either smart nor popular amongst the developers. So, many developers like me wants to store images on any physical location and keep the file location in the table. But, that have issues too, what if somebody delete the files from physical location ? will file entries...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

How to Group by Just Date Portion Of DateTime Field

There are times when we need to group by the table with the date. But Datetime field also contain time part which is very deep. So, there is no way you can group by datetime field and see correct records because it will group by including the time portion of DateTime field. So, to get rid off the time portion in group by clause here is a quick query. 1: select dateadd(dd,0, datediff(dd,0,dateCreated)) as Date,count(*) TotalCount from tblRecords 2: group by dateadd(dd,0, datediff(dd,0,dateCreated))...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Installing SQL Server 2008 Express

Currently, by the time I am posting this stuff SQL Server 2008 is in CTP. And off course, it has several installation issues. For the very first time, when I sit for the installation of SQL Server 2008 Express believe me I run the setup up to four times. So let me share with you, you must need to have the following items installed on your system. Windows Installer 4.5 Redistributed .net Framework 3.5 SP 1 or .net Framework 3.5 SP 1 (Full Download) Power Shell 1.0 Without installing the above component,...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati