Di seguito gli interventi pubblicati in questa sezione, in ordine cronologico.
There are no problems to add SQL linked server to the specific host running it. But what if you need to give it an alias, rather than use hostname as linked server name? Here is how to do it: 1) Step 1: • In SQL Server Management Studio open Linked Servers and then 'New Linked Server'. • Inside of appeared wizard – Select the General tab. • Specify alias name in "Linked server" field. • Select SQL Native Client as provider. • Add sql_server in "Product Name" field (that's the magic). • In "Data Source" – specify name of the host to be used as linked server. 2) Step 2: • In Security tab – specify proper security options (e.g. security context) 3) Step 3: • In Server Options tab – put "Data Access", RPC, "Rpc Out" and "Use Remote Collaboration" to be true. 4) Step 4: • Enjoy.
Quando ti connetti a Office 2007 usando SSIS procedi cosi':
1. trascina l'OLE DB Source nella finestra;
2. fai doppio click sul task OLE DB source;
3. seleziona "Crea nuova Connessione";
4. nelle opzioni del Connection Manager comer provider per excel 2007 scegli il provider "Microsoft 12.0 Access Database Engine OLeDB Provider";
5. fai click sul bottone Data links;
6. si aprira' la maschera delle proprieta' Datalink;
7. fai click sul tab "advanced";
8. fai click sulle corrette "access permissions"
9. seleziona "Data Source" e fai click sul bottone "edit value";
10. inserisci il percorso per il tuo file ".xlsx" o ".xls" e fai "OK";
11. poi seleziona "Extended properties" e fai click su "edit the value";
12. inserisci il seguente valore "Excel 12.0;HDR=YES";
13. fai click su "OK" e esci da tutte le finestre.
Di cj (del 28/04/2010 @ 17:58:07, in SQL Server, linkato 201525 volte)
Questo che segue è un semplice esempio dell'uso di MS Excel come front-end per una semplice query su MS SQL Server.
Sub ADOExcelSQLServer()
Dim Cn As ADODB.Connection
Dim Server_Name As String
Dim Database_Name As String
Dim User_ID As String
Dim Password As String
Dim SQLStr As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Server_Name = "LAPTOP\SQL_EXPRESS" ' Enter your server name here
Database_Name = "Northwind" ' Enter your database name here
User_ID = "" ' enter your user ID here
Password = "" ' Enter your password here
SQLStr = "SELECT * FROM Orders" ' Enter your SQL here
Set Cn = New ADODB.Connection
Cn.Open "Driver={SQL Server};Server=" & Server_Name & ";Database=" & Database_Name & _ ";Uid=" & User_ID & ";Pwd=" & Password & ";" rs.Open SQLStr, Cn, adOpenStatic
With Worksheets("Sheet1")
.Range("A2:Z500")
.ClearContents
.CopyFromRecordset rs
End With
rs.Close
Set rs = Nothing
Cn.Close
Set Cn = Nothing
End Sub
|