Skip to main content

Posts

Showing posts from March, 2010

Resolve Collation error in SQL Server

i often get this error when trying to JOIN some table Cannot resolve the collation conflict between "SQL_Latin1_General_CP850_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. u need to use COLLATION when performing the JOIN, something like this SELECT field1 FROM table1 INNER JOIN table2 ON table1.field3 COLLATE DATABASE_DEFAULT = table2.field4 COLLATE DATABASE_DEFAULT i found this when trying to JOIN, maybe it affect other areas..until i found one see u

Find for SQL Objects, Entities or Text

IF EXISTS (SELECT * FROM Sys.Objects WHERE object_id = OBJECT_ID(N'[dbo].[uspFindObjects]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[uspFindObjects] GO CREATE PROCEDURE uspFindObjects @ObjectType CHAR(2)=NULL, @SearchText VARCHAR(500) = NULL, @SearchType CHAR(1)=NULL, @OrderBy CHAR(1)='N' AS BEGIN /*********************************************************************************************************** Procedure: uspFindObjects Parameters: 1. @ObjectType - Type of object to be searched. - U : Table - P : Stored Procedure - V : View - FN : Function - * : Find All (Tables, SP, Views, Functions) 2. @SearchText - Text to be searched 3. @SearchType - Type of data to be searched - N : Name - C : Column - T : Text 4. @O

How to search all columns of all tables in a database for a keyword

usage: EXEC SearchAllTables 'Computer' CREATE PROC SearchAllTables ( @SearchStr nvarchar(100) ) AS BEGIN -- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved. -- Purpose: To search all columns of all tables for a given search string -- Written by: Narayana Vyas Kondreddi -- Site: http://vyaskn.tripod.com -- Tested on: SQL Server 7.0 and SQL Server 2000 -- Date modified: 28th July 2002 22:50 GMT DECLARE @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(3630)) SET NOCOUNT ON DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110) SET @TableName = '' SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''') WHILE @TableName IS NOT NULL BEGIN SET @ColumnName = '' SET @TableName = ( SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND QUOTENAME(TABLE_

Showing Hidden Device

if u wonder why u have so many network adapters that don't listed in Windows' Device Manager then here is a cure for you :D type this in command prompt set devmgr_show_nonpresent_devices=1 then u will see the hidden devices after that u simply expand the network adapter nodes and it will show the hidden devices see u :D