There Is A Question When I Work On Linkedserver~Pls Kindly Help Me:)
Nov 23, 2005
I have a question when I work on Linkedserver
The Linkedserver name is [Hp-server],the Datebase name is
Newexec,the Table name is Customers_CoypTest
The SQLScript is below:
Update [Hp-server].Newexec.dbo.Customers_CoypTest
set Unitname=b.Unitname
from [Hp-server].Newexec.dbo.Customers_CoypTest a join
Newexec.dbo.Customers_CoypTest b
on a.Cid=b.Cid and b.Cid='Tony'
The server returns ERROR like this:
a) can not open this table '"Newexec"."dbo"."Customers_CoypTest"'
(come from OLE DB provide server 'SQLOLEDB'). provide server do not
support index scan on the data source.
b) [OLE/DB provider returned message:Error occured when
multi-operate.If possible, please check each OLE DB status value.No
work had been completed.]
c) OLE DB Error trace[OLE/DB Provider 'SQLOLEDB'
IOpenRowset::OpenRowset returned 0x80040e21:
[PROPID=DBPROP_COMMANDTIMEOUT VALUE=600 STATUS=DBPROPSTATUS_OK],
[PROPID=Unknown PropertyID VALUE=True STATUS=DBPROPSTATUS_OK],
[PROPID=DBPROP_IRowsetIndex VALUE=True
STATUS=DBPROPSTATUS_NOTSUPPORTED]].
Trying to create mirroring in SQL Server 2005. I followed the steps through Security Wizard. For miror server instance connect I used 'SA' login and pwd..I m not using witness..as i clicked on finish I got below error. On pricipal server i got error message but on mirror server I got success message.
error message:
TITLE: Microsoft SQL Server ------------------------------ SQL Server cannot create the mirroring endpoint, 'Mirroring'. ------------------------------ ADDITIONAL INFORMATION: Create failed for Endpoint 'Mirroring'. (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Endpoint&LinkId=20476 ------------------------------ An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ Database mirroring is disabled by default. Database mirroring is currently provided for evaluation purposes only and is not to be used in production environments. To enable database mirroring for evaluation purposes, use trace flag 1400 during startup. For more information about trace flags and startup options, see SQL Server Books Online. (Microsoft SQL Server, Error: 1498) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1406&EvtSrc=MSSQLServer&EvtID=1498&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
Select @@version for Principal server is Microsoft SQL Server 2005 - 9.00.1406.00 (Intel X86) Mar 3 2007 18:40:02 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)
Select @@version for Mirror server is Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
I searched some google pages and got information that I need to enable DB Mirroring. I followed To configure startup options : and add -T 1400 there and restart service.
also run T-SQL
CREATE ENDPOINT [Mirroring] AS TCP (LISTENER_PORT = 5022) FOR DATA_MIRRORING (ROLE = PARTNER, ENCRYPTION = ENABLED);
but getting error Msg 102, Level 15, State 1, Line 3 Incorrect syntax near 'ENABLED'.
also this ALTER ENDPOINT [Mirroring] STATE = STARTED still get error: Msg 1088, Level 15, State 100, Line 1 Cannot find the object "Mirroring" because it does not exist or you do not have permissions.
Nothing i m seeing on Principal server but getting onw row on mirror server
SELECT * FROM sys.database_mirroring_endpoints;
But still it didnt work for me
One more thing what happened if i did
ALTER ENDPOINT [Mirroring] STATE = STOPPED
on mirror server?? Mirror server remain as it is as it was before doing all above steps???
Hello, I have an asp.net application which connects to SQL Server 2005 database. One out of 15 times (approx) the applicaiton does not make connection to the database and an exception is thrown. I am not sure how to debug this. Should I write some code which can make connections in a loop to test how much stress the sever can handle? Kindly suggest some ideas. Thanks.
I have 2 servers one has SQL 7.0 running on NT4.0 and another has SQL 2000 running on W2K Server. I have established a linked server for SQL 2000 from SQL 7.0.
I don't have any problem of creating linked servers for sql 2000 from sql 7.0. I am also able to create linked server logins to access the sql2000 tables. Even I am able to see the tables on the Databases.
Im sorry if im in the wrong section. My problem is a very common one and it has been hard for me to find the fix.
Ive gone thru Component Services, Firewall settings, Registry and Microsoft Sites, but to avail.
"The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction. [OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ] OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a]."
My Begin Tran doesnt start at all.
begin tran use smartpos go
set identity_insert smartpos.dbo.smp_product on
insert into smartpos.dbo.smp_product (prodId ,[Description] ,barcode ,BuyPriceExclVat ,BuyPriceVatTYpeId ,point ,SupplierID ,Ref ,QtyType ,QtyFactor ,MinStock ,MaxStock ,Active ,ItemType ,ClientLastUpdate ) select prodId ,[Description] ,barcode ,BuyPriceExclVat ,BuyPriceVatTYpeId ,point ,SupplierID ,Ref ,QtyType ,QtyFactor ,MinStock ,MaxStock ,Active ,ItemType ,LastUpdate from server.smartpos.dbo.smp_product svr where not exists (select prodid from smartpos.dbo.smp_product where prodid=svr.prodid)
SELECT * FROM ServidorPrincipal.BDPrincipal.dbo.tblCADENA;
Because it sends this message:
Server: Msg 7356, Level 16, State 1, Line 1 OLE DB provider 'SQLNCLI' supplied inconsistent metadata for a column. Metadata information was changed at execution time.
OLE DB error trace [Non-interface error: Column 'ID_CADENA' (compile-time ordinal 1) of object '"BDPrincipal"."dbo"."tblCADENA"' was reported to have changed. The exact nature of the change is unknown].
I'm trying to change the datasource of a SQL Server LinkedServer using SMO
I've got the relevant linkedserver as an object, changed the DataSource property, and selected it again to confirm the change. However, the change is lost as soon as the object is destroyed. Looking at BoL I think I need to be using alter() method of the linkedserver class but I just get an error Alter failed for LinkedServer '<servername>'.
any ideas how I should be using this class to do what I want?
I can post my script (PowerShell) if it would help.
I'm copying almost all contents of one table from one server/db to another. In relation to speed, what is the difference of using SSIS vs a linked server and sp? I'm going to do the benchmarks, but I'm curious about behind the scenes kinda stuff, theoretically which one if any should be faster and why?
Hello All, I created two database instances in the same MS SQL SERVER 2005 named hafeez and local. I created a linked server from hafeez database to local named HTOL
I created a dummy table in local database named samplocal.
Now i am able to list the records using the linked server, for this i used the following query.
SELECT * FROM OPENQUERY(HTOL,'SELECT nameandval FROM SAMPLOCAL');
Now the problem is, i am not able to insert the rows into the samplocal table using linkedserver. I am using the following query to insert the rows and getting the following errro.
INSERT INTO OPENQUERY(HTOL,'SELECT nameandval FROM SAMPLOCAL') VALUES('tertertetttwertw');
Msg 7356, Level 16, State 1, Line 1 The OLE DB provider "SQLNCLI" for linked server "HTOL" supplied inconsistent metadata for a column. The column "nameandval" (compile-time ordinal 1) of object "SELECT nameandval FROM SAMPLOCAL" was reported to have a "Incomplete schema-error logic." of 0 at compile time and 0 at run time.
Is the above query correct? or shall i miss anything?
I am not expert on SQL server, i need to be able to access different server from withing sproc,
1. Is Linked Server is the best aproach.
2. If yes then how i set it up that it take all authenticated users of this server to remote, i tried with impersonate but it gives error that NT authority dont hae access etc etc (when i try run a sql that accesses remote server)
3. The reason i need to access remote server is ... one of the that table in my db (logTable) is getting to big it is 10 times the size of rest of the db altogether so i though i move it out not just from same db actully put it on a seprate server. so that all the tasks about main db would become easy etc.
We currently have an application that primarily sits on SQL server and needs to access some legacy data in a DB2 database. The solution we are using is to use a linked server between the two servers. The problem with this is that complex queries occasionally cause the driver to fetch a complete table and filter that table locally. I wondered whether service broker (which I have never used) could allow me to access the DB2 database using MQSeries and thus speed up the application as our ODBC calls have low priority on our mainframe.
Thanks and sorry if this sounds a stupid use of service broker.
When running a query with a table from another SQL7 Server that is linked, if only 1 table from each server is specified, the query runs fast and returns only the data rows needed from the linked server. When another table is added on to query (on the server running the query) the query processor tries to run a remote query and return over 400,000 rows over the network. Any suggestions?
UPDATE OPENQUERY(LINKEDSERVER, 'SELECT START_ORDER_NO FROM "OECTLFIL" WHERE "FILE_KEY" = 1') SET START_ORDER_NO = 0
----The START_ORDER_NO field contains a 48
SET START_ORDER_NO = 1~9
----The START_ORDER_NO field contains 49~57 respectively.
SET START_ORDER_NO = 10 ---The START_ORDER_NO field contains 12337 SET START_ORDER_NO = 11 ---The START_ORDER_NO field contains 12593 SET START_ORDER_NO = 12 ---The START_ORDER_NO field contains 12849
incrementing by 256 as I increase the value passed...
ASCII 48-57 are the characters 0-9. The string '10' consists of the two bytes with the values 49 (0x31) and 48 (0x30). It is being viewed in reverse byte order as the value 0x3031 which equals 12337 (48*256 + 49).
The LinkedServer is Pervasive SQL 2000i using 'OLE DB Provider for ODBC'
The START_ORDER_NO field is a Numeric(8,0)
I'm thinking some kind of Unicode, or translation or code page issue, but I haven't had any luck yet.
I'm not sure how difficult this is, I don't think I'm a neophyte but I'm feeling like one...
My error is that 'Name tr is not declared' tr.Rollback() I tried moving the 'Dim tr As SqlTransaction' outside the try but then I get 'Variable tr is used before it si assinged a value'. What is the correct way? Try conn.Open() Dim tr As SqlTransaction tr = conn.BeginTransaction() cmdInsert1.Transaction = tr cmdInsert1.ExecuteNonQuery() cmdInsert2.Transaction = tr cmdInsert2.ExecuteNonQuery() cmdInsert3.Transaction = tr cmdInsert3.ExecuteNonQuery() tr.Commit() Catch objException As SqlException tr.Rollback() Dim objError As SqlError For Each objError In objException.Errors Response.Write(objError.Message) Next Finally conn.Close() End Try
I have the below procedure that will not work- I must be losing my mind, this is not that difficult - mental roadblock for me. Using SQL Server 2000 to create SP being called by ASP.Net with C# code behind stored procedure only returns if input exactly matches L_Name PROCEDURE newdawn.LinkNameLIKESearch @L_Name nvarchar(100)AS SELECT [L_Name], [L_ID], [C_ID], [L_Enabled], [L_Rank], [L_URL] FROM tblContractorLinkInfo WHERE L_Name LIKE @L_Name RETURN I tried: WHERE L_Name LIKE ' % L_Name % ' no luck. What am I missing? Thank you
SELECT H.id, H.CategoryID ,H.Image ,H.StoryId ,H.Publish, H.PublishDate, H.Date ,H.Deleted ,SL.ListTitle,C.CategoryTitle FROM HomePageImage H JOIN shortlist SL on H.StoryId = SL.id (INNER JOIN category C on H.CategoryId = C.CategoryId) order by date DESC
I have a textbox and a checkbox on a form and I'd like to add both values to a db. The textbox value gets inserted fine but I'm having trouble with the checkbox. Any ideas would be greatly appreciated.
Beside working right from the server how else someone can perform the SQL admistration job, I guess my question is how do most SQL DBA perform their administration without going to the server directly. Anyone --- can help please??
Declare @StartDate datetime Declare @EndDate Datetime Set @StartDate = dateadd(day, datediff(day, 0, getdate()), 0) Set @EndDate = getdate()
The job runs at 11:30 pm so I want the start date to be the same but the time to be equal to 00:00:00.0 When I run the getdate does it also return a time stamp?
I had a problem where some users were experiencing timeouts when trying to add a single record to a table with 2.3 million records. It's not a very wide table; only 10 columns and the biggest column in varchar 500. The rest are guid, datetime, tinyint...
There is also an old VB app that inserts about 3000 records a day into this table during office hours while users occasionally try and insert a record into this table.
Something said to me that the problem could be indexes but I wasn't quite sure because I though indexes only have an impact on select, delete & update. And not particulary on insert. But I checked it out anyway and noticed that the 3 indexes (1 column PK, 1 column Clustered & 1 column non-clustered) weren't padded. So I changed that (Fill Factor 95) and the problem has gone away. But why? I thought the insert would just have appended it to the end of the index before I made this change? Why would that time out?
I have the following queries. The first returns the 'Unknown' row, the second works the way I would expect. Are my expectations wrong? Can someone describe for me what is going on?
Thanks
Code Snippet select * FROM SynonymComFinancialCategory b LEFT JOIN TT_FinancialCategory a ON a.FinanceGroup = b.FinanceGroup AND a.FinanceCode = b.FinanceCode AND a.Finance = b.Finance AND b.Finance <> 'Unknown' WHERE a.FinanceGroup IS NULL AND a.FinanceCode IS NULL AND a.Finance IS NULL
Code Snippet select * FROM SynonymComFinancialCategory b LEFT JOIN TT_FinancialCategory a ON a.FinanceGroup = b.FinanceGroup AND a.FinanceCode = b.FinanceCode AND a.Finance = b.Finance WHERE a.FinanceGroup IS NULL AND a.FinanceCode IS NULL AND a.Finance IS NULL AND b.Finance <> 'Unknown'
Hi,I have the following table with some sample values, I want to return the first non null value in that order. COALESCE does not seem to work for me, it does not return the 3rd record. I need to include this in my select statement. Any urgent help please.Mobile Business PrivateNULL 345 NULL4646 65464 65765NULL 564654654 564 6546I want the following as my results:Number3454646564654654Select COALESCE(Mobile,Business,Private) as Number from Table returns:3454646654654 (this is a test to see if private returns & it did with is not null but then how do i include in my select statement to show any one of the 3 fields)select mobile,business,private where private is not null returns:657655646546thanks
Hello,I created a formview in a web page. The data are in a sql server express database.With this form, I can to create a new data, I delete it but I can't to modify the data.The app_data folder is ready to write data; the datakeynames element in formview web control declared. I replace the automated query created by VS 2005 by a strored procedure to see if the problem solved.The problem is the same with an update query or a update stored procedure...Have you an idea, please.Than you for your help.Regards.
Im working with a detailsview and when I try to edit something and then update, the changes are not saved. I have 2 tables ("[etpi.admin].Ocorrencias" and "[etpi.admin].SMS") that store the data that Im trying to change. Since Im having problems with the name of tables, Im coding it manually, using SQL server management studio and VWD. I believe my code can be wrong (Im new to vwd and C# world), so here it is: UpdateCommand="UPDATE [etpi.admin].Ocorrencias SET [Status_Ocor] = @Status_Ocor, [Percentual] = @Percentual, [IDPriori] = @IDPriori, [Abertura] = @Abertura, [IDTecRes] = @IDTecRes, [Area] = @Area, [CodEquip] = @CodEquip, [Descricao] = @Descricao, [Destinatario] = @Destinatario, [Data_Implanta] = @Data_Implanta WHERE [etpi.admin].Ocorrencias.IDOcorre = @IDOcorre UPDATE [etpi.admin].SMS SET [idSMS] = @idSMSWHERE [etpi.admin].SMS.IDOcorre = @IDOcorre"> <UpdateParameters><asp:Parameter Name="idSMS" Type="Int32" /><asp:Parameter Name="Status_Ocor" Type="String" /><asp:Parameter Name="Percentual" Type="Int32" /><asp:Parameter Name="IDPriori" Type="Int32" /><asp:Parameter Name="Abertura" Type="DateTime" /><asp:Parameter Name="IDTecRes" Type="Int32" /><asp:Parameter Name="Area" Type="String" /><asp:Parameter Name="CodEquip" Type="Int32" /><asp:Parameter Name="Descricao" Type="String" /><asp:Parameter Name="Destinatario" Type="String" /><asp:Parameter Name="Data_Implanta" Type="DateTime" /><asp:Parameter Name="IDOcorre" Type="Int32" /></UpdateParameters> Thx.
My rollback does not work In my SP I want any of cmdS,cmdS2,cmdS3,cmdS4 produces error Rollback must be executed for all of cmdS,cmdS2,cmdS3,cmdS4 . I tested for error producing situation but no rollbak occured. How can I solve this problem. Thanks. Below is my SP . .......... .......... .......... begin transaction .......... ..........If Len(ltrim(rtrim(@cmdS)))>0 execute(@cmdS) If Len(ltrim(rtrim(@cmdS2)))>0 execute(@cmdS2) If Len(ltrim(rtrim(@cmdS3)))>0 execute(@cmdS3) If Len(ltrim(rtrim(@cmdS4)))>0 execute(@cmdS4) If Len(ltrim(rtrim(@cmdS)))>0 or Len(ltrim(rtrim(@cmdS2)))>0 or Len(ltrim(rtrim(@cmdS3)))>0 or Len(ltrim(rtrim(@cmdS4)))>0 Beginif @@ERROR <>0 begin rollback transaction set @Hata = 'Error !' end Else Beginset @Hata = 'Sucessfully executed :)' End End commit transaction RETURN
I can test it in query builder but when i preview the page and go to do the search i get nothing Here is my statement SELECT Employees.Last_Name, Employees.First_Name, Job_Transaction.Name, Seq_Descript.Seq_DescriptionFROM Call_List INNER JOIN Call_Group ON Call_List.Group_ID = Call_Group.Group_ID AND Call_List.Group_ID = Call_Group.Group_ID INNER JOIN Employees ON Call_List.Clock = Employees.Clock INNER JOIN Job_Transaction ON Call_Group.Group_ID = Job_Transaction.Group_ID INNER JOIN Seq_Descript ON Call_List.Sequence = Seq_Descript.SequenceWHERE (Call_List.Clock = @Clock) Mike
Hi all.I have used a SqlDataSource in my page with this delete command:DELETE FROM tblPersonnel WHERE (ID = @original_ID)and the "OldValueParameterFormatSring" property of the datasource is "original_{0}".and i also have a GridView and a button for delete in rows.(it's CommandName is "Delete"). But when i try to delete a record, the record does not get deleted and this button only makes a PostBack on the page! Why doesn't it work? Thanks in advance.
hi all, i have created a gridview with the select,delete and insert commands working properly. but the update command does not work. when i edit a column and click the update button, it generates no errors but does not save the changes. it just brings back the original values. i dont know wats missing. can anyone help me? this is part of my code:UpdateCommand="UPDATE [test101] SET Surname=@Surname, Names=@Names,Registration=@Registration,[Course code]=@Course_code,Grade=@Grade WHERE ID=@ID1 "<UpdateParameters> <asp:Parameter Name="Surname" Type=String /> <asp:Parameter Name="Names" Type=String /> <asp:Parameter Name="Registration" Type=String /> <asp:Parameter Name="Course_code" Type=String /> <asp:Parameter Name="Grade" Type=Int32 /> <asp:Parameter Name="ID1" Type=Int32 /> </UpdateParameters>
Hi,I am having trouble with a WHERE clause:WHERE (([A] = @A) AND ([B] >= @B) AND (([C] < [D])) OR ([C] = 0 AND [D] = 0)) It's meant to only select data where A = @A, and B is more than or equal to @B, and one of the next two are true: C is less than D or C and D are both 0 Thanks,Jon
I am trying to get the id of last entered record and I used select ID command but it doesn't give me the ID of last record enteredProtected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click Dim name, address, nice As String Dim sConnString, sSQL, sID As String Dim u As MembershipUsername = Me.name.Textaddress = Me.address.Text
u = Membership.GetUser(User.Identity.Name) nice = u.ToString()sSQL = "INSERT into test ([Address],[Name], [username]) values ('" & _ address & "', '" & _name & "', '" & _ nice & "'); SELECT ID FROM test WHERE (ID = SCOPE_IDENTITY())" MsgBox(sID) MsgBox(sSQL) sConnString = ConfigurationManager.ConnectionStrings("aspnetdbConnectionString1").ConnectionString.ToString()Using MyConnection As New System.Data.SqlClient.SqlConnection(sConnString)Dim MyCmd As New System.Data.SqlClient.SqlCommand(sSQL, MyConnection) MyConnection.Open() MyCmd.ExecuteNonQuery() MyConnection.Close() End UsingResponse.Redirect("transferred.aspx?value=2") End Sub End Class
I am using the below WHERE clause and it will not filter out records where Companies.CompanyEmail = b@c.com WHERE (Companies.CompanyEmail <> 'a@a.com') this does not work, is the @ causing a problem? also tried 'a@a.com%' with no success. WHERE (tblCompanies.C_CompanyEmail <> 'none') this works fine. Thank you