Accessing Different Database on Different SQL Servers I was trying to Access two databases on two different servers. I was usring four part name to SQlServer “[sqlserver02].MyDatabase.dbo.aspnet_membership” but it was not letting me do that and was showing following error message. Msg 7202, Level 11, State 2, Line 1 Could not find server ‘sqlserver02′ in [...]
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 [...]
Json, Jquery, $.ajax(), asp.net and c# to get ajaxed data table rows passing multiple parameters I got a request from my client that before creating user they want to see the list of existing users with the like first name and last name. I didn’t want to use asp.net ajax update panel and full post [...]
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 [...]
I wanted to concatinate multiple address fields as a single field separated by comma. Here is the solution which is doing job for me. 8000 is the Max length of varchar data type in sql server. Using COALESCE() function saves lot of IF or CASE decision logics. This function Returns the first nonnull expression among [...]
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 [...]
Today I used Managed Assembly to use Regular Expression in SQL server 2005. I wanted to search for all records which contain special characters in my data and some foreign characters so I was using following SQL Query Select OrganisationId,organisationname from organisation Where organisationname like ‘%-%’ OR OrganisationName like ‘%&%’ OR OrganisationName like ‘%(%’ OR [...]
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 + 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 = [...]
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 [...]