Two methods to update data from one table to another table using sql and TSQl

Two methods to updated data from one table to another table using sql and TSQL, T1=Table1 T2=Table2 F1=Field1 F2=Field2 F3=Filed3 F4=Field4 Method one, Update date using subquery from one table to another table update T2 set T2.F1=isnull(T1.F1,”), T2.F2= T1.F2, T2.F3= T1.F3 from T1 inner join T2 on T2.F2= T1.F4 where T2.F2<> T1.F2 and T2.F3<> T1.F3 […]

Regular expression Replace and Match used in managed sql

Every one knows the power of .net clr (Dot Net Common Language Runtime).  Following are are two functions which are being used by me in sql server 2005. RegexMatch function returns the true false (0/1); it takes two parameters input as characters or string and Regular expression to match. RegexRpelace function replaces the carachters passed […]

Using (nolock) with SQL Select Query in SQL Server 2005

I was using following query select top 10 * from [sqlserver02\sqlserver02].mydatabase.dbo.aspnet_membership (nolock) whereas “sqlserver02″ was a remote serever  and I found following errro Msg 4122, Level 16, State 1, Line 1 Remote table-valued function calls are not allowed. Then I remove (nolock) from the query and it worked. Does any one know why remote serever […]

Accent Insensitive search in sql server + COLLATE SQL_Latin1_General_CP1_CI_AI

We were facing a problem in searcing the exact data from Microsoft sql server 2005 database, Our database is containng foreign language characters ,çéèêëñòóôõöàáâãäåìíîïùúûüŵŷýÿ as you can see in following data, I was wondering how we can solve this problem, I tried to search it on the google and posted this in some forums. The Coleg Sir Gâr   […]

Linked Servers +Microsft SQL Server, Excel, Access (Ms-Access)

Linked Servers + Distributed Queries Linking to External Data Sources Following stored procedure will allow you to create a link to another SQL Server. Link server name would be “SECOND” EXEC sp_addlinkedserver @server=‘myservername’,–name you will be using to refer link server @srvproduct = ‘Excel’, –Product name i.e excel @provider = ‘Microsoft.Jet.OLEDB.4.0′, –Jet engine @datasrc = […]

Update table column from another table column + SQL

Note : T=Table, C=Column, C2 for T1 and T2 got same values.  I want to update T1.C1 values from T2.C1. What would be the SQL Query. update T1 set T1.C1=T2.C1 from T2inner join T1 on T2.C2=T1.C2 Above sql query will update all values from table 2 column 1 to table 1 column1 where table1 and table2 […]