Showing posts with label connection. Show all posts
Showing posts with label connection. Show all posts

Friday, February 24, 2012

Capture NT User ID

Access front-end, SQL Server 2005 backend.

I have users connected to SQL Server via a Microsoft Access user-
interface.
Connection is via NT login.

I want to log users' activities to the database with their userid.

How can I capture their NT User ID (via VBA in Access)?

Thanks,
BubblesYou could create a view in SQL Server, I guess, like:

CREATE VIEW dbo.NTUsername
AS
SELECT [username] = SUSER_SNAME();

Now VBA should be able to query from that view in SQL Server just like it
would any other table or view...

--
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"bubbles" <bubbles.one@.hotmail.comwrote in message
news:1175737278.694527.78540@.q75g2000hsh.googlegro ups.com...

Quote:

Originally Posted by

Access front-end, SQL Server 2005 backend.
>
I have users connected to SQL Server via a Microsoft Access user-
interface.
Connection is via NT login.
>
I want to log users' activities to the database with their userid.
>
How can I capture their NT User ID (via VBA in Access)?
>
Thanks,
Bubbles
>

Sunday, February 12, 2012

Can't use Package Variable to specify the filename for a Connection

I'm attempting to modify a flatfile import package so that I can reuse it to import several other files into the same table. I was unable to use package variables (containing the import filename) in the Flat File Connection Manager file name field. What is the proper way to solve this kind of problem in SSIS?Have you looked up property expressions in BOL? Give that a look.
http://sqljunkies.com/WebLog/knight_reign/archive/2005/02/12/7750.aspx
Thanks,
K|||

I setup a ForEach Loop Container to do this.

Create a Package Variable, for example, "varFileName", for the FileName. Then edit the ForEach Loop container. Select "Variable Mappings". Select the drop-down under the "Variable" column and select your "User: varFileName" variable. The index column should read "0". Save the object. Now add a Data Flow task and double-click to edit.

In the Data Flow window, create a Source Script transformation. Define your output columns on the "Inputs and Outputs" option. Click "Script" and add your variable "varFileName" to the property "ReadOnlyVariables". Now click the "Design Script" button, which opens up another window for scripting.

Add "Imports System.IO" to the top so you can read the flat file.

Read the file with the following code:

Dim strRecord as String
Dim objFlatFile As StreamReader = File.OpenText(Variables.varFileName)
Do Until objFlatFile.Peek = -1
strRecord = objFlatFile.ReadLine
[OutputBuffer].AddRow()
[OutputBuffer].[Column1] = Mid$(stRecord,1,4)
... etc.
Loop

Let me know if this helps...

Can't use DAC in SQL2K5.

SQL2K5
No SP.
Im trying to test out Dedicated Administrator Connection for my first time
and getting an error message:
____________________________
Cannot connect to admin:Server\InstanceName.
Additional information:
DAC's are not supported. (ObjectExplorer)
_________________________
The Browser service is running.
Any ideas?
TIA, ChrisRHi ChrisR
Is it a SQL Express instance?
From BOL: To conserve resources, SQL Server 2005 Express Edition does not
listen on the DAC port unless started with a trace flag 7806.
Is it a remote instance?
DAC must be enabled for remote connections from the Configuration
Manager.
HTH
Kalen Delaney, SQL Server MVP
"ChrisR" <ChrisR@.noEmail.com> wrote in message
news:OLSsHeBjGHA.4748@.TK2MSFTNGP04.phx.gbl...
> SQL2K5
> No SP.
> Im trying to test out Dedicated Administrator Connection for my first time
> and getting an error message:
>
> ____________________________
> Cannot connect to admin:Server\InstanceName.
> Additional information:
> DAC's are not supported. (ObjectExplorer)
> _________________________
> The Browser service is running.
> Any ideas?
> TIA, ChrisR
>|||No ma'am.
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Oct 14 2005 00:33:37
Copyright (c) 1988-2005 Microsoft Corporation
Enterprise Evaluation Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Also, it is on my local workstation.
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:e0gkxtCjGHA.4512@.TK2MSFTNGP04.phx.gbl...
> Hi ChrisR
> Is it a SQL Express instance?
> From BOL: To conserve resources, SQL Server 2005 Express Edition does
not
> listen on the DAC port unless started with a trace flag 7806.
> Is it a remote instance?
> DAC must be enabled for remote connections from the Configuration
> Manager.
> --
> HTH
> Kalen Delaney, SQL Server MVP
>
> "ChrisR" <ChrisR@.noEmail.com> wrote in message
> news:OLSsHeBjGHA.4748@.TK2MSFTNGP04.phx.gbl...
time[vbcol=seagreen]
>|||Ok, I duplicated this. You can't use DAC to connect to the Object Explorer,
only when opening a query window.
HTH
Kalen Delaney, SQL Server MVP
"ChrisR" <ChrisR@.noEmail.com> wrote in message
news:%231B2YEEjGHA.1264@.TK2MSFTNGP05.phx.gbl...
> No ma'am.
> Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
> Oct 14 2005 00:33:37
> Copyright (c) 1988-2005 Microsoft Corporation
> Enterprise Evaluation Edition on Windows NT 5.0 (Build 2195: Service Pack
> 4)
> Also, it is on my local workstation.
>
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:e0gkxtCjGHA.4512@.TK2MSFTNGP04.phx.gbl...
> not
> time
>|||To continue, your initial connection can't be DAC so first open the Mgmt
Studio without DAC, and then open a query window with a DAC.
HTH
Kalen Delaney, SQL Server MVP
"ChrisR" <ChrisR@.noEmail.com> wrote in message
news:%231B2YEEjGHA.1264@.TK2MSFTNGP05.phx.gbl...
> No ma'am.
> Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
> Oct 14 2005 00:33:37
> Copyright (c) 1988-2005 Microsoft Corporation
> Enterprise Evaluation Edition on Windows NT 5.0 (Build 2195: Service Pack
> 4)
> Also, it is on my local workstation.
>
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:e0gkxtCjGHA.4512@.TK2MSFTNGP04.phx.gbl...
> not
> time
>|||Perfect, thanks alot Kalen!
Have a great weekend!
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:uzgZg$EjGHA.4884@.TK2MSFTNGP03.phx.gbl...
> To continue, your initial connection can't be DAC so first open the Mgmt
> Studio without DAC, and then open a query window with a DAC.
> --
> HTH
> Kalen Delaney, SQL Server MVP
>
> "ChrisR" <ChrisR@.noEmail.com> wrote in message
> news:%231B2YEEjGHA.1264@.TK2MSFTNGP05.phx.gbl...
Pack[vbcol=seagreen]
does[vbcol=seagreen]
>

Can't use DAC in SQL2K5.

SQL2K5
No SP.
Im trying to test out Dedicated Administrator Connection for my first time
and getting an error message:
____________________________
Cannot connect to admin:Server\InstanceName.
Additional information:
DAC's are not supported. (ObjectExplorer)
_________________________
The Browser service is running.
Any ideas?
TIA, ChrisRHi ChrisR
Is it a SQL Express instance?
From BOL: To conserve resources, SQL Server 2005 Express Edition does not
listen on the DAC port unless started with a trace flag 7806.
Is it a remote instance?
DAC must be enabled for remote connections from the Configuration
Manager.
--
HTH
Kalen Delaney, SQL Server MVP
"ChrisR" <ChrisR@.noEmail.com> wrote in message
news:OLSsHeBjGHA.4748@.TK2MSFTNGP04.phx.gbl...
> SQL2K5
> No SP.
> Im trying to test out Dedicated Administrator Connection for my first time
> and getting an error message:
>
> ____________________________
> Cannot connect to admin:Server\InstanceName.
> Additional information:
> DAC's are not supported. (ObjectExplorer)
> _________________________
> The Browser service is running.
> Any ideas?
> TIA, ChrisR
>|||No ma'am.
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Oct 14 2005 00:33:37
Copyright (c) 1988-2005 Microsoft Corporation
Enterprise Evaluation Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Also, it is on my local workstation.
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:e0gkxtCjGHA.4512@.TK2MSFTNGP04.phx.gbl...
> Hi ChrisR
> Is it a SQL Express instance?
> From BOL: To conserve resources, SQL Server 2005 Express Edition does
not
> listen on the DAC port unless started with a trace flag 7806.
> Is it a remote instance?
> DAC must be enabled for remote connections from the Configuration
> Manager.
> --
> HTH
> Kalen Delaney, SQL Server MVP
>
> "ChrisR" <ChrisR@.noEmail.com> wrote in message
> news:OLSsHeBjGHA.4748@.TK2MSFTNGP04.phx.gbl...
> > SQL2K5
> > No SP.
> >
> > Im trying to test out Dedicated Administrator Connection for my first
time
> > and getting an error message:
> >
> >
> > ____________________________
> > Cannot connect to admin:Server\InstanceName.
> >
> > Additional information:
> > DAC's are not supported. (ObjectExplorer)
> > _________________________
> >
> > The Browser service is running.
> >
> > Any ideas?
> >
> > TIA, ChrisR
> >
> >
>|||Ok, I duplicated this. You can't use DAC to connect to the Object Explorer,
only when opening a query window.
--
HTH
Kalen Delaney, SQL Server MVP
"ChrisR" <ChrisR@.noEmail.com> wrote in message
news:%231B2YEEjGHA.1264@.TK2MSFTNGP05.phx.gbl...
> No ma'am.
> Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
> Oct 14 2005 00:33:37
> Copyright (c) 1988-2005 Microsoft Corporation
> Enterprise Evaluation Edition on Windows NT 5.0 (Build 2195: Service Pack
> 4)
> Also, it is on my local workstation.
>
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:e0gkxtCjGHA.4512@.TK2MSFTNGP04.phx.gbl...
>> Hi ChrisR
>> Is it a SQL Express instance?
>> From BOL: To conserve resources, SQL Server 2005 Express Edition does
> not
>> listen on the DAC port unless started with a trace flag 7806.
>> Is it a remote instance?
>> DAC must be enabled for remote connections from the Configuration
>> Manager.
>> --
>> HTH
>> Kalen Delaney, SQL Server MVP
>>
>> "ChrisR" <ChrisR@.noEmail.com> wrote in message
>> news:OLSsHeBjGHA.4748@.TK2MSFTNGP04.phx.gbl...
>> > SQL2K5
>> > No SP.
>> >
>> > Im trying to test out Dedicated Administrator Connection for my first
> time
>> > and getting an error message:
>> >
>> >
>> > ____________________________
>> > Cannot connect to admin:Server\InstanceName.
>> >
>> > Additional information:
>> > DAC's are not supported. (ObjectExplorer)
>> > _________________________
>> >
>> > The Browser service is running.
>> >
>> > Any ideas?
>> >
>> > TIA, ChrisR
>> >
>> >
>>
>|||To continue, your initial connection can't be DAC so first open the Mgmt
Studio without DAC, and then open a query window with a DAC.
--
HTH
Kalen Delaney, SQL Server MVP
"ChrisR" <ChrisR@.noEmail.com> wrote in message
news:%231B2YEEjGHA.1264@.TK2MSFTNGP05.phx.gbl...
> No ma'am.
> Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
> Oct 14 2005 00:33:37
> Copyright (c) 1988-2005 Microsoft Corporation
> Enterprise Evaluation Edition on Windows NT 5.0 (Build 2195: Service Pack
> 4)
> Also, it is on my local workstation.
>
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:e0gkxtCjGHA.4512@.TK2MSFTNGP04.phx.gbl...
>> Hi ChrisR
>> Is it a SQL Express instance?
>> From BOL: To conserve resources, SQL Server 2005 Express Edition does
> not
>> listen on the DAC port unless started with a trace flag 7806.
>> Is it a remote instance?
>> DAC must be enabled for remote connections from the Configuration
>> Manager.
>> --
>> HTH
>> Kalen Delaney, SQL Server MVP
>>
>> "ChrisR" <ChrisR@.noEmail.com> wrote in message
>> news:OLSsHeBjGHA.4748@.TK2MSFTNGP04.phx.gbl...
>> > SQL2K5
>> > No SP.
>> >
>> > Im trying to test out Dedicated Administrator Connection for my first
> time
>> > and getting an error message:
>> >
>> >
>> > ____________________________
>> > Cannot connect to admin:Server\InstanceName.
>> >
>> > Additional information:
>> > DAC's are not supported. (ObjectExplorer)
>> > _________________________
>> >
>> > The Browser service is running.
>> >
>> > Any ideas?
>> >
>> > TIA, ChrisR
>> >
>> >
>>
>|||Perfect, thanks alot Kalen!
Have a great weekend!
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:uzgZg$EjGHA.4884@.TK2MSFTNGP03.phx.gbl...
> To continue, your initial connection can't be DAC so first open the Mgmt
> Studio without DAC, and then open a query window with a DAC.
> --
> HTH
> Kalen Delaney, SQL Server MVP
>
> "ChrisR" <ChrisR@.noEmail.com> wrote in message
> news:%231B2YEEjGHA.1264@.TK2MSFTNGP05.phx.gbl...
> > No ma'am.
> >
> > Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
> >
> > Oct 14 2005 00:33:37
> >
> > Copyright (c) 1988-2005 Microsoft Corporation
> >
> > Enterprise Evaluation Edition on Windows NT 5.0 (Build 2195: Service
Pack
> > 4)
> >
> > Also, it is on my local workstation.
> >
> >
> >
> > "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> > news:e0gkxtCjGHA.4512@.TK2MSFTNGP04.phx.gbl...
> >> Hi ChrisR
> >>
> >> Is it a SQL Express instance?
> >> From BOL: To conserve resources, SQL Server 2005 Express Edition
does
> > not
> >> listen on the DAC port unless started with a trace flag 7806.
> >>
> >> Is it a remote instance?
> >> DAC must be enabled for remote connections from the Configuration
> >> Manager.
> >>
> >> --
> >> HTH
> >> Kalen Delaney, SQL Server MVP
> >>
> >>
> >> "ChrisR" <ChrisR@.noEmail.com> wrote in message
> >> news:OLSsHeBjGHA.4748@.TK2MSFTNGP04.phx.gbl...
> >> > SQL2K5
> >> > No SP.
> >> >
> >> > Im trying to test out Dedicated Administrator Connection for my first
> > time
> >> > and getting an error message:
> >> >
> >> >
> >> > ____________________________
> >> > Cannot connect to admin:Server\InstanceName.
> >> >
> >> > Additional information:
> >> > DAC's are not supported. (ObjectExplorer)
> >> > _________________________
> >> >
> >> > The Browser service is running.
> >> >
> >> > Any ideas?
> >> >
> >> > TIA, ChrisR
> >> >
> >> >
> >>
> >>
> >
> >
>