Skip to main content

Posts

Showing posts with the label SQL SERVER

Fulltext predicate references columns from two different tables or indexed views

Fulltext predicate references columns from two different tables or indexed views SELECT      dbo . CustomerMap . DisplayCategoryId ,  dbo . Customer . CompanyName , dbo . Customer . website , dbo . CustomerMap . Description ,                       dbo . Country . Country , dbo . Customer . phoneNo , dbo . Customer . Mobile , dbo . Customer . FaxNo , dbo . Customer . Address , dbo . Customer . AboutUsUrl ,                       dbo . Customer . ProductUrl , dbo . Customer . EnqiryUrl , dbo . Customer . email          FROM          dbo . CustomerMap INNER JOIN                 ...

Creating Full Text Search Catalog and Full Text Search Sql Server 2005

Creating Full Text Search Catalog and Full Text Search USE dbSur EXEC sp_fulltext_database   'enable' --1  First Create the catalog (if you already have then skip this step) EXEC sp_fulltext_catalog    'SearchOffers' , 'create' --2  Add a full text index to a table with index_name EXEC sp_fulltext_table    'PostOffer' , 'create' , 'SearchOffers' , 'PK_PostOffer' --3  Add a column to the full text index EXEC sp_fulltext_column     'PostOffer' , 'Title' , 'add' EXEC sp_fulltext_column     'PostOffer' , 'Description' , 'add' --4  Activate the index on table EXEC sp_fulltext_table      'PostOffer' , 'activate' --5  Start full population EXEC sp_fulltext_catalog    'SearchOffers' , 'start_full'

Insert Data Into The Table SQL SERVER

  First we have to create table with the table name Student with the following fields in which we are going to insert records. Column Name Data Type Length Std_Name Varchar 50 Address Varchar 50 City Varchar 50 Age Numeric 8 DOB DateTime 8 Class Varchar 10 Insert Data Into The Table for execution of queries open the new query window from the Microsoft Sql Server Management Studio. Select SQL Server from the drop down combo if you are using the client else in case of server enter (local) like above. Select window authentication or SQL Server authentication according to your system installation and click on OK. Query window will appear as you click on New Query marked as first red. Select your database from the combo displaying at the toolbar above on the screen. Now write down the following query in the displaying window. ·  ...

To View a Stored Procedure,Triggers,Functions

Just wanted to quickly check the stored procedure logic from the SQL Query Analyzer.  SQL Server allows us to view the definition, information, and dependencies of a stored procedure,function and triggers.                  1. To view the definition of a stored procedure: sp_helptext   procedureName 2. To view the information about a stored procedure:  sp_help   procedureName 3. To view the dependencies of the stored procedure:  sp_depends   procedureName 'procedureName' is name of stored procedure,function and triggers also. You can also put these 'procedureName' between single quote. If you are going to view function then put   function name such as sp_helptext GetDownlinePairCountInfo Sp_helpText is very good option for viewing the sp’s, Trigger’s , View’s and functions .

Retrieve & display image from sql database in vb.net

In my previous post I have discuss about how to store image into sql server database using vb.net. It is time to fetch image from sql server database and display into picture box. Here is the snapshot of vb.net code. First of all we have to imports these namespace in our class. Imports System.IO Imports System.IO.Stream Public Function getImagefromByte( ByVal data As Byte ()) As Image         Dim ms As MemoryStream = New MemoryStream()         Dim img As Image         Try             ms.Write(data, 0, data.GetUpperBound(0))             img = Image.FromStream(ms)         Catch ex As Exception             img = My .Resources.noimage ...

Convert Image To Bytes in VB.Net

Sometimes we need to convert image to bytes to store image into SQL server database. First of all we have to imports some namespace in our class. Imports System.IO Imports System.IO.Stream here is vb code for that conversion. Public Function ConvertImageToByte( ByVal Img As Image) As Byte ()         Dim ms As MemoryStream = New MemoryStream()                 Img.Save(ms, Img.RawFormat)         Dim data(ms.Length) As Byte         ms.Position = 0         ms.Read(data, 0, ms.Length)         ms.Close()         ms = Nothing         ConvertImageToByte = data     End Function Happy Co...

SQL SERVER : Shrinking and Truncation of Log File ,Log Full

SQL Query for Srink and Trucation of Log File in Sql Server 2005. Here I want to describe some tricks to truncate log file for a database in SQL Server 2005. If primary transaction log file is exceed in large volume then is it good to restrict size , there is nothing wrong impact if we restrict the size. First get Logical name of Log file . 1. Open SQL Server Management Studio and connect to the Sql Server. 2. Right Click on Database Name.Click on Properties. 3. Copy the name in Red Circle this is the Log File name. And replace this log name into given query. 4. Result Set Here is the SQL Query to copy and execute with replacement with your requirement. Use AMS dbcc shrinkfile ( AIMS_LOG , 1 ) backup log AMS with truncate_only dbcc shrinkfile ( AIMS_LOG , 2 )

VB.Net : Save Image to Sql Server Database in VB.Net

Store Image into SQL Database using VB.Net Here is the steps to save image into database.I'm using picture box to show saved image in database. Before all this create one database, and one table with the name  tbl_Employee  and the  following  feilds Field Name Data Type Empcode int Address Varchar(500) Password Varchar(50) Photo image Here is interface which is used in pick image from local system. Having picture box and two button Add Photo, Remove Photo . Here is code for Add Photo button. Private Sub cmdAddPhoto_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddPhoto.Click         If dlgOpen.ShowDialog() = Windows.Forms.DialogResult.OK Then             pic.Image = Image.FromFile(dlgOpen.FileName)      ...