User Token Is Different When SP Is Executed In Management Studio Vs Application
Hello,
I have a stored procedure that outputs login token and user token information. The stored procedure has
WITH EXECUTE AS CALLER specified.
When I execute the stored procedure from Management Studio I get the following output from the stored procedure
<login_token pid="267" sid="AQUAAAAAAAUVAAAAdbl1VI3r6l4jX2Nr0AYAAA==" name="MYDOMAINjoe" type="WINDOWS LOGIN" />
<login_token pid="2" sid="Ag==" name="public" type="SERVER ROLE" />
<login_token pid="3" sid="Aw==" name="sysadmin" type="SERVER ROLE" />
<login_token pid="257" sid="AQIAAAAAAAUgAAAAIAIAAA==" name="BUILTINAdministrators" type="WINDOWS GROUP" />
... (more groups)
<user_token pid="7" sid="AQUAAAAAAAUVAAAAdbl1VI3r6l4jX2Nr0AYAAA==" name="MYDOMAINjoe" type="WINDOWS LOGIN" />
<user_token pid="0" name="public" type="ROLE" />
<user_token pid="5" sid="AQUAAAAAAAUVAAAAdbl1VI3r6l4jX2NrCAUAAA==" name="MYDOMAINPeople" type="WINDOWS GROUP" />
<user_token pid="16" name="approleDirector" type="ROLE" />
<user_token pid="16384" name="db_owner" type="ROLE" />
When I execute the stored procedure through my application (IIS application connecting to SQLServer 2005 through SQL Native Client - not .NET)
I get the following
<login_token pid="267" sid="AQUAAAAAAAUVAAAAdbl1VI3r6l4jX2Nr0AYAAA==" name="MYDOMAINjoe" type="WINDOWS LOGIN" />
<login_token pid="2" sid="Ag==" name="public" type="SERVER ROLE" />
<login_token pid="3" sid="Aw==" name="sysadmin" type="SERVER ROLE" />
<login_token pid="257" sid="AQIAAAAAAAUgAAAAIAIAAA==" name="BUILTINAdministrators" type="WINDOWS GROUP" />
... (more groups)
<user_token pid="1" sid="AQUAAAAAAAUVAAAAdbl1VI3r6l4jX2Nr4QQAAA==" name="dbo" type="WINDOWS LOGIN" />
The login token is the same but the user token is dbo instead of the actual user.
What am I doing wrong?
Thanks.
View Complete Forum Thread with Replies
Related Forum Messages:
- Security Error When Execute Sp From An Application, But Not From SQL Management Studio.
- Different Results When Running Procedure From Management Studio Vs Application Code
- Differentiate Between Whether Stored Procedure A Is Executed Inside Query Analyzer Or Executed Inside System Application Itself.
-
Suggestions For How To Build An Application Gateway Using Builtin SQL User Management?
- What User Is Used When Executing An SSIS Package From Management Studio?
- Windows Authentication - Connecting To A DB As A Different User In Management Studio
- How Can I See My Databases In Management Studio Express, As A Limited User?
- Can A Non-administrator User Run The SQL Server Management Studio Express ?
-
How To Create A User Account For My Web Site In SQL Server Management Studio
- SQL Sever 2005 Management Studio - Connect As Different Windows User
- Creating A User In SQLExpress With SQL Server Management Studio Express
-
SQL Database User Account Access Remotely Via SQL Management Studio Express
- How To View Permissions Of User-defined Database Roles In Management Studio?
- Stored Procedure Executing Durations Are Different Between Executing From Application(web) And SQl Server Management Studio - Qu
-
Stored Procedure Executing Durations Are Different Between Executing From Application(web) And SQl Server Management Studio - Query Window
- Error Parsing Query: [ Token Line Number = 1,Token Line Offset = 83,Token In Error = 5 ]
- There Was An Error Parsing The Query. [ Token Line Number = 1,Token Line Offset = 43,Token In Error = C]
- SQL Server Management Studio Express: Object Explorer - How To Re-attach The Content Of User-defined Database
- SQL Server Management Studio Express: Object Explorer - How To Re-attach The Content Of User-defined Database
- T-SQL And Visual Basic 2005 Codes That Execute A User-Defined Stored Procedure In Management Studio Express (Part 2)
- T-SQL And Visual Basic 2005 Codes That Execute A User-Defined Stored Procedure In Management Studio:How To Declare EXEC && Sp?
- DTS Package Can't Be Executed From Within A VB 6.0 Application
- How To Get The Sql Statement Executed From External Application?
- How To Configure SQL Server Management Studio Express To Allow Doing Non-User-Instance/ADO.NET 2.0 From VB 2005 Express?
- Simple Examples Of SQLCLR By Connecting To SQL Express User Instances In Management Studio Via VB 2005 Express
- SQL Server Management Studio Express: User Instances Listed/founded In SSEUtil - How They Got In And Stay In SSEUtil?
-
How To Use Xcopy && User Instance To Copy 3 Dbo Tables From The Database Of SQL Server Management Studio Express To The App_Data Folder Of Website Of VWD Express Project?
- Management Studion Express Alongside Full-blown Management Studio?
- Passing SAML Token From Security Token Service To Reporting Service
-
Failed To Generate A User Instance Of SQL Server Due To Failure In Retrieving The User's Local Application Data Path. Please Make Sure The User Has A Local User Profile On The Computer. The Connection Will Be Closed
- SQL Server Management Express Studio Management Tools
-
Visual Studio Database File And SQL Server Management Studio Express Question
-
The Database Created Using Management Studio Cannot Be Connected To Visual Studio???help
-
Visual Studio 2005 Standard And SQL Server Management Studio?
-
How Do I Get The Database That I Am Using In Visual Studio Into My SQL Server Management Studio?
- Is Management Studio Express Compatible With Visual Studio?
- What Is The Different Between Manangement Studio And Management Studio Express
- Job Failed (SSIS). Executed As User: SRVDESASQL2005SYSTEM.
- Server Express, Management Studio Express, Visual Studio Standard, And An ASP.NET Page....
-
Please Help *** Failed To Generate A User Instance Of SQL Server Due To Failure In Retrieving The User's Local Application Data Path
-
Failed To Generate A User Instance Of SQL Server Due To Failure In Retrieving The User's Local Application Data Path
- SQL Server 2005: User Security Management: User Ch
- Same DTS Fails Executed As Job ,but Run Fine When Executed From DTS Designer
- Ent Mgr. Management-CurrentActivity-Application - Error?
- Web Application And Role Management In Sql Server 2005
-
Management Studio
- Management Studio
- Where Is Management Studio
- Management Studio
- Management Studio
- Where To Get SQL Management Studio?
Security Error When Execute Sp From An Application, But Not From SQL Management Studio.
Hello, I am facing a very odd behavior with SQL server 2005. I have a database role with specific permissions to execute only some of the stored procedures in the database. I also have a SQL login/user attached to the role. If I execute one of the stored procedures from the application (web application, with Microsoft enterprise library database block) I am getting a security error stating that I need select permission for the schema. However, If I execute the same sp with the same parameters from SQL management studio, connecting with the same SQL login as in the application I can execute the sp without any security errors. The SQL management studio is in on a different server than the targeted database. Are there any differences between executing stored procedures from SQL MS and from application when using the same SQL login? Thanks, IT
View Replies !
Different Results When Running Procedure From Management Studio Vs Application Code
I'm updating a process that recreates a large table every night. The table is the result of a bunch of nightly batch processes and holds a couple million records. In the past, each night at the end of the batch jobs the table would be dropped and re-created with the new data. This process was embodied in dynamic sql statements from an MFC C++ program, and my task is to move it to a SQL Server 2000 stored procedure that will be called from a .Net app. Here's the relevant code from my procedure: sql Code: Original - sql Code -- recreate new empty BatchTable table print 'Dropping old BatchTable table...' exec DropBatchTable --stored procedure called from old code that does a little extra work when dropping the table -- validate drop If exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BatchTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) Begin RAISERROR( 'Unable to drop old BatchTable!',0,1) WITH NOWAIT End Else Begin print 'Old BatchTable dropped.' End print 'Creating new BatchTable...' SELECT TOP 0 *, cast('' as char(3)) as Client, cast('' as char(12)) as ClientDB INTO dbo.BatchTable FROM differentDB.dbo.BatchArchives --validate create If Not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BatchTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) Begin RAISERROR( 'Unable to create new BatchTable!',0,1) WITH NOWAIT End Else Begin print 'New BatchTable Created.' End -- recreate new empty BatchTable table print 'Dropping old BatchTable table...' exec DropBatchTable --stored procedure called from old code that does a little extra work when dropping the table -- validate drop IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[BatchTable]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1) BEGIN RAISERROR( 'Unable to drop old BatchTable!',0,1) WITH NOWAIT END ELSE BEGIN print 'Old BatchTable dropped.' END print 'Creating new BatchTable...' SELECT TOP 0 *, CAST('' AS CHAR(3)) AS Client, CAST('' AS CHAR(12)) AS ClientDB INTO dbo.BatchTable FROM differentDB.dbo.BatchArchives --validate create IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[BatchTable]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1) BEGIN RAISERROR( 'Unable to create new BatchTable!',0,1) WITH NOWAIT END ELSE BEGIN print 'New BatchTable Created.' END The print statements are there because the .net app will read them in and then write them to a log file. Some of the other mechanics are there to mimic the old process. The idea is to duplicate the old process first and then work on other improvements. This works in Management studio. The .Net App reports that the old table was dropped, but when it tries to create the new table it complains that "There is already an object named 'BatchTable' in the database." I have verified that the old table is removed. Any ideas on how to fix this?
View Replies !
Differentiate Between Whether Stored Procedure A Is Executed Inside Query Analyzer Or Executed Inside System Application Itself.
Just wonder whether is there any indicator or system parameters that can indicate whether stored procedure A is executed inside query analyzer or executed inside application itself so that if execution is done inside query analyzer then i can block it from being executed/retrieve sensitive data from it? What i'm want to do is to block someone executing stored procedure using query analyzer and retrieve its sensitive results. Stored procedure A has been granted execution for public user but inside application, it will prompt access denied message if particular user has no rights to use system although knew public user name and password. Because there is second layer of user validation inside system application. However inside query analyzer, there is no way control execution of stored procedure A it as user knew the public user name and password. Looking forward for replies from expert here. Thanks in advance. Note: Hope my explaination here clearly describe my current problems.
View Replies !
What User Is Used When Executing An SSIS Package From Management Studio?
All: I am working with a package that executes a stored procedure. This stored procedure makes use of a Linked Server. When I execute it in debug mode in VS 2005, it works flawlessly. However when I deploy it to the production server and execute it by going to Management Studio, connecting to Integration Services, navigating to MSDB, right clicking and choosing "run package" I get the infamous: Login failed for user '(null)'. Not associated with a trusted SQL Server Connection. OLE DB Provider SQLNCLI for linked server [name] returned message "Communication Link Failer" error. If I execute the stored procedure by itself on the production server, it works flawlessly. It is only when this stored procedure gets executed via the above mentioned way inside of an SSIS pack that I get this error. To me this suggest it is being executed as a different user, but I don't know which one. Any help would be wonderful. Thank you in advance... AccDev
View Replies !
Windows Authentication - Connecting To A DB As A Different User In Management Studio
Is there a way to connect to database using Windows authentication as a different user than what you've logged in with to your desktop? For example: I log on to my desktop as mydomainme. I'm developing queries using Management Studio against a database (on another server) where mydomainme doesn't have access, but the admins have granted access to mydomainJobs1. I have the password for mydomainJobs1, and I'm hoping I can connect to the database using that account without having to log-off my local desktop as mydomainme and then re-login using mydomainJobs1. The analogy in the file/share-permissions world would be using "net use" from a command prompt: net use \SomeServer /User:mydomainJobs1 jobs1password Anything similar for SSMS?
View Replies !
How Can I See My Databases In Management Studio Express, As A Limited User?
I installed SQL Server 2005 Express, and Management Studio Express, while logged on as an Administrator of my XP Pro machine. When I switch to my limited user account, Management Studio Express seems not to be aware that SQL Server is even running on the machine (although Configuration Manager can see it and reports that it is running). I'm sure I've missed something simple, but I can't find the answer anywhere... how can I get access to my local SQL Server from my limited user account?
View Replies !
Can A Non-administrator User Run The SQL Server Management Studio Express ?
If i install the SQL Server Express and the Management Studio in my computer with an administrator account... can a non-administrator user run the SQL Server Management Studio Express ? When the non-administrator user tries run the SSEMS, he gets an error, something like "Cannot load the SQL Management Studio Package". Can i set several permissions to let non-administrator users run the SSEMS ?
View Replies !
How To Create A User Account For My Web Site In SQL Server Management Studio
Hi, I keep getting a connection failed error message... CANNOT the DATABASE " " requested by the Login. The Login failed for User 'NT Authority/ Network Service' error and I figure I should create an account for the site to access the Database with but I do not know how to create an account in SQL server using the Management studio?? Anyone willing to give me the exact information I need to do this so I do not do something else and ruin things please??? I am not much of an SQL DBA. thanks in Advance.
View Replies !
SQL Sever 2005 Management Studio - Connect As Different Windows User
I want to connect to a SQL server from my workstation using the application in the Subject, but I need to connect as a different Windows user. Basically, I login to my workstation with my "Joe User" account, but for servers I used my "Joe Admin" account for security purposes. However, the Management console autofills in my workstation username when I select "Windows authentication" for the connection, and grays out the username/password fields so that I cannot specify another set of credentials. Is there a way to change this behavior? Otherwise I will need to termserv into a server using my administrative account, install the management software there, and then begin the process. That is a lot of unecessary overhead that I would like to avoid. Thank You, John G
View Replies !
SQL Database User Account Access Remotely Via SQL Management Studio Express
Hi, I hope you can help.I have configured a Windows 2003 web server and SQL 2005 Server (on same box) to successfully allow remote connections and to allow access via SQL Server Management Studio Express 2005.The problem I have is that I want to restrict access to the databases on the server via the Management Studio to specific databases e.g. 1 database user "sees" only 1 database.I can configure it so that the user's remote access permissions do not allow access to other databases but they can still "see" the database listed in the Management Studio explorer.I can also configure it so that the users cannot see all the databases (by disabling View All Databases on SQL Server), but this means that they cannot not see their own database which they have permissions for.Is it impossible to have the desired behaviour of only displaying the database which the remote user accessing has permissions for and hiding all other databases?I have MSN'd,Googled and Yahoo'd this one to no avail :(Many thanksFergus
View Replies !
How To View Permissions Of User-defined Database Roles In Management Studio?
As part of our security project, I've done the following when logged in as 'sa': Created database roles 'dbrole1' within dbAccount Created login and user 'user1' and added user to be a member of 'dbrole1' Granted execute permissions on sp1 and sp2 to 'dbrole1' However, I didn't see the above permissions listed in SQL Server Management Studio - Database - Security - Roles - Database Roles - 'dbrole1' properties - securables Any ideas? Thanks!
View Replies !
Error Parsing Query: [ Token Line Number = 1,Token Line Offset = 83,Token In Error = 5 ]
Hey all- I'm trying to insert some values into an SQL Compact database on a WM6 device but there is something apparently wrong with my SQL statement... The program is going to allow users to schedule an SMS message to be sent at a certain date and time. I'm using a database to keep track of the scheduled SMS messages. The database has 3 rows: phone number, message, and the date/time to be sent. Here is the relevent code: private void scheduleMenu_Click(object sender, EventArgs e) { //connect to DB and do our scheduling magic string message = messageBox.Text; //should rename messageBox... string phoneNum = phoneNumBox.Text; string dataBase = @"Program FilesSMS_Scheduler2SMSDatabase.sdf"; //SqlCeEngine eng = new SqlCeEngine(dataBase); SqlCeConnection conn = new SqlCeConnection("Data Source=" + dataBase); conn.Open(); //insert phone number, message text, and date/time into DB string cmd = "INSERT INTO Scheduler(phoneNum, message, date) VALUES("+ phoneNum + ", "+ message + ", "+ dateTimePicker1.Value +")"; SqlCeCommand cmdPhone = new SqlCeCommand(cmd,conn); cmdPhone.ExecuteNonQuery(); //error occures here... messageBox.Text = ""; MessageBox.Show("Message Scheduled!"); } I'm guessing it doesn't like how I am trying to get the data from the different text boxes and the DateTimePicker to go inside the SQL command. Does anyone have any ideas on how to fix my SQL command or how to get data from a textbox and DateTimePicker to be inserted into a database a different way?
View Replies !
There Was An Error Parsing The Query. [ Token Line Number = 1,Token Line Offset = 43,Token In Error = C]
Hello all Trying to delete some data from a SSCE (2005) DB produces the exception: SqlCeException There was an error parsing the query. [ Token line number = 1,Token line offset = 43,Token in error = C] Here is the code I am using string dsc = Application.StartupPath + "\FCDB07.sdf"; conn = new SqlCeConnection("DataSource = " + dsc); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandText = "DELETE FROM DataContainer WHERE FileName =" + dgContainers[0, SelRowIndex].Value.ToString(); cmd.ExecuteNonQuery(); //There was an error parsing the query. [ Token line number = 1,Token line offset = 43,Token in error = C ] conn.Close(); Any Idea on What causes this? TIA Trophus
View Replies !
SQL Server Management Studio Express: Object Explorer - How To Re-attach The Content Of User-defined Database
Hi all, I just found that the content of my Database "ssmsExpressDB" is gone, but the name "ssmsExpressDB" remains in the Object Explorer of SQL Server Management Studio Express. If I delected the name "ssmsExpressDB" and executed the following .sql: exec sp_attach_db @dbname = N'ssmsExpressDB', @filename1 = N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB.mdf', @filename2 = N'C:Program filesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB_log.LDF' GO I got the following error message: Msg 5120, Level 16, State 101, Line 1 Unable to open the physical file "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". And I have closed all my projects and I do not know what " The process cannot access the file because it is being used by another process" is all about!? Please help and tell me how I can re-attach the content of my "ssmsExpressDB" in the Object Explorer of SQL Server Management Studio Express. Thanks in advance, Scott Chang ==================================================================================== I found the "ssmsExpressDB" is being used by my VB 2005 Express project "Hello-SQLCLR-1": in the Database Explorer, Data Connections place. How can I put it back to the Object Explorer of SQL Server Management Studio Express? Please help and advise. =======================================================
View Replies !
SQL Server Management Studio Express: Object Explorer - How To Re-attach The Content Of User-defined Database
Hi all, I just found that the content of my Database "ssmsExpressDB" is gone, but the name "ssmsExpressDB" remains in the Object Explorer of SQL Server Management Studio Express. If I delected the name "ssmsExpressDB" and executed the following .sql: exec sp_attach_db @dbname = N'ssmsExpressDB', @filename1 = N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB.mdf', @filename2 = N'C:Program filesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB_log.LDF' GO I got the following error message: Msg 5120, Level 16, State 101, Line 1 Unable to open the physical file "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". And I have closed all my projects and I do not know what " The process cannot access the file because it is being used by another process" is all about!? Please help and tell me how I can re-attach the content of my "ssmsExpressDB" in the Object Explorer of SQL Server Management Studio Express. Thanks in advance, Scott Chang ==================================================================================== I found the "ssmsExpressDB" is being used by my VB 2005 Express project "Hello-SQLCLR-1": in the Database Explorer, Data Connections place. How can I put it back to the Object Explorer of SQL Server Management Studio Express? Please help and advise. =====================================================================================
View Replies !
T-SQL And Visual Basic 2005 Codes That Execute A User-Defined Stored Procedure In Management Studio Express (Part 2)
Hi Jonathan Kehayias, Thanks for your valuable response. I had a hard time to sumbit my reply in that original thread yesterday. So I created this new thread. Here is my response to the last code/instruction you gave me: I corrected a small mistake (on Integrated Security-SSPI and executed the last code you gave me. I got the following debug error message: 1) A Box appeared and said: String or binary data would be truncated. The statement has been terminated. |OK| 2) After I clicked on the |OK| button, the following message appeared: This "SqlException was unhandled String or binary data would be truncated. The statement has been terminated." is pointing to the "Throw" code statement in the middle of ....................................... Catch ex As Exception MessageBox.Show(ex.Message) Throw Finally .......... Please help and advise how to correct this problem in my project that is executed in my VB 2005 Express-SQL Server Management Studio Express PC. Thanks, Scott Chang The code of my Form1.vb is listed below: Imports System.Data Imports System.Data.SqlClient Imports System.Data.SqlTypes Public Class Form1 Public Sub InsertNewFriend() Dim connectionString As String = "Data Source=.SQLEXPRESS;Initial Catalog=shcDB;Integrated Security=SSPI;" Dim connection As SqlConnection = New SqlConnection(connectionString) Try connection.Open() Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection) command.CommandType = CommandType.StoredProcedure command.Parameters.Add("@procPersonID", SqlDbType.Int).Value = 7 command.Parameters.Add("@procFirstName", SqlDbType.NVarChar).Value = "Craig" command.Parameters.Add("@procLastName", SqlDbType.NVarChar).Value = "Utley" command.Parameters.Add("@procAddress", SqlDbType.NVarChar).Value = "5577 Baltimore Ave" command.Parameters.Add("@procCity", SqlDbType.NVarChar).Value = "Ellicott City" command.Parameters.Add("@procState", SqlDbType.NVarChar).Value = "MD" command.Parameters.Add("@procZipCode", SqlDbType.NVarChar).Value = "21045" command.Parameters.Add("@procEmail", SqlDbType.NVarChar).Value = "CraigUtley@yahoo.com" Dim resulting As String = command.ExecuteNonQuery MessageBox.Show("Row inserted: " + resulting) Catch ex As Exception MessageBox.Show(ex.Message) Throw Finally connection.Close() End Try End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load InsertNewFriend() End Sub End Class
View Replies !
T-SQL And Visual Basic 2005 Codes That Execute A User-Defined Stored Procedure In Management Studio:How To Declare EXEC && Sp?
Hi all, In my SQL Server Management Studio Express (SSMSE), I executed the following sql code suuccessfully: --insertNewRocord.sql-- USE shcDB GO CREATE PROC sp_insertNewRecord @procPersonID int, @procFirstName nvarchar(20), @procLastName nvarchar(20), @procAddress nvarchar(50), @procCity nvarchar(20), @procState nvarchar(20), @procZipCode nvarchar(20), @procEmail nvarchar(50) AS INSERT INTO MyFriends VALUES (@procPersonID, @procFirstName, @procLastName, @procAddress, @procCity, @procState, @procZipCode, @procEmail) GO EXEC sp_insertNewRecord 7, 'Peter', 'Wang', '678 Old St', 'Detroit', 'Michigon', '67899', 'PeterWang@yahoo.com' GO ======================================================================= Now, I want to insert a new record into the dbo.Friends table of my shcDB by executing the following T-SQL and Visual Basic 2005 codes that are programmed in a VB2005 Express project "CallshcDBspWithAdoNet": --Form1.vb-- Imports System.Data Imports System.Data.SqlClient Imports System.Data.SqlTypes Public Class Form1 Public Sub InsertNewFriend() Dim connectionString As String = "Integrated Security-SSPI;Persist Security Info=False;" + _ "Initial Catalog=shcDB;Data Source=.SQLEXPRESS" Dim connection As SqlConnection = New SqlConnection(connectionString) connection.Open() Try Dim command As SqlCommand = New SqlCommand("sp_InsertNewRecord", connection) command.CommandType = CommandType.StoredProcedure EXEC sp_insertNewRecord 6, 'Craig', 'Utley', '5577 Baltimore Ave', 'Ellicott City', 'MD', '21045', 'CraigUtley@yahoo.com' Console.WriteLine("Row inserted: " + _ command.ExecuteNonQuery().ToString) Catch ex As Exception Console.WriteLine(ex.Message) Throw Finally connection.Close() End Try End Sub End Class =========================================================== I ran the above project in VB 2005 Express and I got the following 5 errors: 1. Name 'EXEC' is not declared (in Line 16 of Form1.vb) 2. Method arguments must be enclosed in parentheses (in Line 16 of Form1.vb) 3. Name 'sd-insertNewRecord' is not declared. (in Line 16 of Form1.vb) 4.Comma, ')', or a valid expression continuation expected (in Line 16 of Form1.vb) 5. Expression expected (in Line 16 of Form1.vb) ============================================================ I know that "EXEC sp_insertNewRecord 6, 'Craig', 'Utley', '5577 Baltimore Ave', 'Ellicott City', 'MD', '21045', 'CraigUtley@yahoo.com' "in Line 16 of Form1.vb is grossly in error. But I am new in doing the programming of T-SQL in VB 2005 Express and I am not able to change it. Please help and advise me how to correct these problems. Thanks in advance, Scott Chang
View Replies !
DTS Package Can't Be Executed From Within A VB 6.0 Application
Hello, I have a VB 6.0 application which is using a SQL Server with two databases. At certain point the user must be able to convert data from one database to the other and this is done with an DTS package being execute from within a Visual Basic application running on the client workstation. I use the following sourcecode to handle this request: Set objPackage = New DTS.Package 'Set Parameter Values ' sServer = objSettings.Server ' sUsername = objSettings.UserID ' sPassword = objSettings.Password ' sPackageName = objSettings.DTSPackage CmdExit.Enabled = False ' Load Package Call objPackage.LoadFromSQLServer(mVar_DTSServer, mVar_DTSUser, mVar_DTSPassword, DTSSQLStgFlag_Default, , , , mVar_DTSPackage) ' Only call the following when developing the application. You ' can comment out the call when you build your application. 'If CheckIde Then Call ChangeAllStepsToRunOnMainThread(objPackage) Call ChangeAllStepsToRunOnMainThread(objPackage) ' Execute objPackage.Execute ' Get Status and Error Message For Each oStep In objPackage.Steps If oStep.ExecutionResult = DTSStepExecResult_Failure Then oStep.GetExecutionErrorInfo lErr, sSource, sDesc sMessage = sMessage & "Step """ & oStep.Name & """ Failed" & vbCrLf & _ vbTab & "Error: " & lErr & vbCrLf & _ vbTab & "Source: " & sSource & vbCrLf & _ vbTab & "Description: " & sDesc & vbCrLf & vbCrLf bError = True Else sMessage = sMessage & "Step """ & oStep.Name & _ """ Succeeded" & vbCrLf & vbCrLf End If Next objPackage.UnInitialize This is working fine from a number of systems, but there are a few systems on which it doesn't work. Does anybody knows what is missing on those systems or is there a way to check a system (and of course repair it) so it will work in the future?
View Replies !
How To Configure SQL Server Management Studio Express To Allow Doing Non-User-Instance/ADO.NET 2.0 From VB 2005 Express?
Hi all, For the first time, I want to set up the configuration of my SQL Server Management Studio Express (SSMSE) to allow me in doing the non-User-Instance/ADO.NET 2.0 programming from my VB 2005 Express. The SSMSE and VB 2005 Express are in my Windows XP Pro PC that is part of our NT 4 LAN System in our office. I read the article "How to configure SQL Server 2005 to allow remotre connections" in http://support.microsoft.com/kb/914277/ about (i) "Enable remote connections for SQL Server 2005 Express", (ii) Enable the SQL Server Browser service", (iii) Create exception in Windows Firewall, and (iv) Create an exception for the SQL Server Browser service in Windows Firewall. I entered the SQL Server Surface Area Configuration and I could not decide what options I should take for doing the non-User-Instance/ADO.NET 2.0 programming from my VB 2005 Express. I have the following questions on the page of "Minimize SQL Server 2005 Surface Area": (1) I saw "Configure Surface Area for localhost [change computer]". I clicked on [change computer] and I saw the following: Select Computer The Surface Area Configuration of this surface area of this computer or a remote computer. Specify a computer to configure: O Local computer O Remote computer Should I choose the "Local computer" or the "Remote computer" option? (2) Below the "Configure Surface Area for localhost [change computer]", I clicked on "Surface Area Configuration for Service and Connections", Select a component and then configure its services and connections: |-| SQLEXPRESS |-| Database Engine Service I picked => Remote Connection On the right-hand side, there are: O Local connections only O Local and remorte connections O Using TCP/IP O Using named pipes only O Using both TCP/IP and named pipes Should I choose O Local and remorte connections and O Using named pipes only? Please help and tell me what options I should choose in (1) and (2). Thanks in advance, Scott Chang
View Replies !
Simple Examples Of SQLCLR By Connecting To SQL Express User Instances In Management Studio Via VB 2005 Express
Hi all, I want to do SQLCLR by Connecting to SQL Express User Instances in Management Studio via VB 2005 Express and I have read the following articles and books: (i) Connecting to SQL Express User Instances in Management Studio in http://blogs.msdn.com/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-insta... (ii) Managing SQL Server Express with SQL Server 2005 Management Studio Express Edition in http://www.microsoft.com/technet/sql/2005/mgsqlexpwssmse.mspx (iii) Chapter 16 - Going Beyand Transact-SQL: Using the SQL Common Language Rutime (SQLCLR) in Microsoft SQL Server 2005 Express Edition for Dummies (iv) Chapter 21 - Working with the Common Language Runtime in Microsft SQL Server 2005 Programming for Dummies (v) Chapter 4 - Introduction to Common Language Runtime (CLR) Integration in Programming SQL Server 2005 by Bill Hamilton. I want to create an SQLCLR project "HelloWorld" by Connecting to SQL Express User Instances in Management Studio via VB 2005 Express. But I am still not sure how to get it started, because I do not understand the following things: (1) Pipe Name for a User Instance, (2) Enabling (or Disabling) the CLR by using Transact-SQL, (3) Creating a Transact-SQL script, (4) Creating an Assembly, (5) Creating a backup device, etc. I need to see some simple examples of SQLCLR by Connecting to SQL Express User Instances in Management Studio via VB 2005 Express. Please help and tell me where in the websites I can find them. Thanks in advance, Scott Chang
View Replies !
SQL Server Management Studio Express: User Instances Listed/founded In SSEUtil - How They Got In And Stay In SSEUtil?
I have used SQL Server Management Studio Express (SSMSE) and Visual Basic 2005 Express (VBE) for more than one year to pick up the Transect-SQL, ADO.NET 2.0, SQL Server 2005 Express, SQLCLR, etc. Yesterday, I used SSEUtil to execute: C:SSEUtil>SSEUtil -l I got the following: 1. master 2. tempdb 3. model1 4. msdb 5. 56713D4D965AE4455_TSVISUAL STUDIO 2005PROJECTSMYFIRSTAPPSSE-VBEXPRESS-WINDOWSAPPLICATION1BINDEBUGMYDB1.MDF 6. C:DOCUMENTS AND SETTINGSCOTT H CHANGMY DOCUMENTSVISUAL STUDIO 2005PROJECTSMASTERDETAILMASTERDETAILBINDEBUGMYDB1.MDF 7. C:ADONET2CODE-JOHNSONVBCHAPTER02CONNECTEDCLASSESSETBINDEBUGPUBS.MDF 8. C:PROGRAM FILESMICROSOFT SQL SERVERMSSQL.1MSSQLDATANORTHWIND.MDF 9. C:ADVENTUREWORKSLTADVENTUREWORKSLT_DATA.MDF I created some VBE projects and used some examples from some tutorial books and websites in the past. But, I thought that user instance timeout is 60 minutes and user instances should be gone after 60 minutes. Why do I have the above-mentioned user instances remained in SSEUtil now? Please explain this thing for me. Thanks, Scott Chang
View Replies !
How To Use Xcopy && User Instance To Copy 3 Dbo Tables From The Database Of SQL Server Management Studio Express To The App_Data Folder Of Website Of VWD Express Project?
Hi all, I have read/studied (i) Working with Databases in Visual Web Developer 2005 Express in http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/vwd.aspx, (ii) Xcopy Deployment (SQL Server Express) in http://msdn2.microsoft.com/en-us/library/ms165716.aspx, (iii) User Instances for Non-Administrators in http://msdn2.microsoft.com/en-us/library/ms143684.aspx, and (iv) Embedding SQL Server Server Express in Applications in http://msdn2.microsoft.com/en-us/library/ms165660.aspx. I do not understand the concepts and procedures to do Xcopy and User Instances for non-administrators completely-I do not know how to connect to databases and create database diagrams or schemas using the Database Explorer. I have a stand-alone Windows XP Pro PC. I have created a ChemDatabase with 3 dbo tables in the SQL Server Management Studio of my SQL Server Express and a website of my VWD Express application with an App_Data folder. I am not able to proceed to use Xcopy and user instance to bring the 3 dbo tables of ChemDatabase to my App_Data folder. Please help and give me some detailed procedures/instructions to bring the 3 dbo tables of ChemDatabase (or ChemDatabase itself) from the SQL Server Management Studio Express to the App_Data folder of the website of my VWD Express project? Thanks in advance, Scott Chang
View Replies !
SQL Server Management Express Studio Management Tools
I have recently installed the SQL Server Management Studio Express but I do not find Management Tools in order to create scheduled backups and shrinking of the databases. I was under the impression that this should be included in the Management Studio. I use the SQL 2005 Express for smaller customers who run the SQL on a desktop unit. I need a way to backup the data to a server machine for backup purposes. I have uninstalled and reinstalled to no avail.
View Replies !
Visual Studio Database File And SQL Server Management Studio Express Question
I have a database in my "App_Data" folder of my visual studio project. I can view it fine in Visual Studio's built-in tools for managing a database attached to a solution. However i recently started playing around with the SQL Server Management Studio Express program. When i attach my database to Management Studio, and try to run my program it crashes. I think it might be a permissions error?!? When i detatch it and reattach it in visual studio it runs fine again. Any suggestions? ThanksJason
View Replies !
Visual Studio 2005 Standard And SQL Server Management Studio?
I am new to visual studio and I am still not sure of all its components and features. I installed visual studio 2005 standard edition but cannot find SQL Server Management Studio? I guess this must be because it is not included with Visual studio 2005 standard. Is it included with VS 2005 professional? I want to add pictures of products to my shopping site using an SQL database and I’ve been told that SQL Server Management studio is required as it is a graphical tool. How would I go about obtaining the SQL server management studio. There seems to be different versions of SQL server that it is confusing to know which one to purchase. Will the SQL server 2005 version that comes with Visual studio standard be sufficient for me now right? I want to create a shopping site with hundreds, perhaps even thousands of products. I want to use an SQL server 2005 database. The database will include ‘dynamically generated’ product images if that is the correct terminology. My goodness, it seems I still have so much to learn. Thanks
View Replies !
Job Failed (SSIS). Executed As User: SRVDESASQL2005SYSTEM.
Hi everyone, I've made SSIS using domain security and after that it has been scheduled by Sql Server Agent. But that job fails and looking into history job I read: "Executed as user: SRVDESASQL2005SYSTEM. The package execution failed. The step failed." Mssql Server agent is being used for local system. Is there the problem? Nevertheles the aforementioned user have sysadmin role. Does anyone ever faced this kind of issue? Thanks in advance,
View Replies !
Server Express, Management Studio Express, Visual Studio Standard, And An ASP.NET Page....
I believe I'm missing something as far as my configuration goes...I'm new to working with SQL server and the databinding I'm trying to do. I have an ASP.NET page that has a radio button list box which I have databound to a database served up by SQL Express I'm having a lot of problems with connections... I was going to enumerate the behavior under each configuration (local only, remote tcp/ip only, remote pipes only, remote both), but I've realized that it is just flaky. Sometimes I can connect to the db with SQL Studio express, sometimes not. Sometimes I can add new tables and edit tables, sometimes not. Sometimes I can create a new connection when trying to databind from within Visual Studio, and sometimes not (sometimes I can't even connect, other times, I can connect initially but when I build a query through the designer it then has problems). Lastly, sometimes the ASP.NET page works correctly and sometimes not. This all seems to be mostly independent of how I configure SQL Server as far as what kinds of connections are allowed. I thought there was a pattern, but as I tested it more rigorously I found there wasn't. What I would like to do is be connected to the same DB with Visual Studio and SQL Studio, edit the DB as I wish, databind to it, and test my ASP.NET page, all without needing to jump through a bunch of hoops (although right now I wouldn't even know what those hoops are...it's just a shot in the dark as to what will work). It's all quite maddening and any help would be appreciated.
View Replies !
Failed To Generate A User Instance Of SQL Server Due To Failure In Retrieving The User's Local Application Data Path
I installed my asp.net 2.0 web application and sql express june editon on my windows 2003 server.When the application tries to reach the database i am getting the following error"Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed."I can understand that it has something to do with user right but more than that I am pretty lost. Can anyone translate this error for me and give me some tips on what do to.I checked first the user running the sql express service and saw it was the NETWORK SERVICE user. I changed it to be the local system account but that did not make any difference. The application is running just fine on my local computer(Win XP sp2). This one has SQL express April edition though.
View Replies !
SQL Server 2005: User Security Management: User Ch
How do you handle user level security with SQL Server 2005? Say I have an HR database. In Active Directory I have two groups: Managers, Employees. Now in this HR Database I want to setup permissions in such a way that Managers can see all employees under them (but not other managers) and the employees can only see themselves. (I'd have various levels of management defined in a table somewhere, so that each employee has a manager ID that links to another employee so that the CEO would be manager of everyone by working down the chain). What I'm trying to understand is the best way to handle the permissions. I'm not entirely clear on how to deal with that. Would I use user chaining to do that, I wouldn't need impersonation (that's just for instances where you want dynamic SQL and it won't execute with user chaining, correct?) Anyway, just looking for some general direction on this (obviously I need to get a good book it would seem). Would I create a stored procedure that runs with EXECUTE AS permissions so that I'd have a non-interactive login it uses that has table access then all the other users have permission to execute the sproc? So that sproc runs, pulls back a SELECT * FROM tbl_HRINFO and using a WHERE constraint limits who is returned WHERE SupervisorID = CurrentLoggedInEmployeeID ? Also: How can I determine who is logged in and running the procedure, would the sproc use the SELECT USER_NAME command to see who was running it? As you can see, I'm working from square one on all of this. Not sure if my posting entirely made sense, but hopefully someone can get me pointed in the right direction, thanks!
View Replies !
Same DTS Fails Executed As Job ,but Run Fine When Executed From DTS Designer
I created DTS a while ago and placed in job to run once a day (it worked fine for 3 months) 2 days ago I changed sa password and now job fails with error (Login failed for user 'sa'.), but it run fine from DTS !!! 1. My DTS created with domain Account DomainSVCSQL2000( sa rights and local admin) 2. SVCSQL service use DomainSVCSQL2000 to run 3. SVCSQL agent use DomainSVCSQL2000 to run 4. DTS use 'osql -E Where should look for reference to sa ? Executed as user: MONTREALsvcsql2000. DTSRun: Loading... Error: -2147217843 (80040E4D); Provider Error: 18456 (4818) Error string: Login failed for user 'sa'. Error source: Microsoft OLE DB Provider for SQL Server Help file: Help context: 0. Process Exit Code 1. The step failed.
View Replies !
Ent Mgr. Management-CurrentActivity-Application - Error?
I'm having a problem with couple of users on our network not connecting to SQL exactly right. In the CurrentActivity window under the application column these users are not showing the authenticated usernames. Example: it should be username@computername but all that shows is @computername. These users get weird security problems that I have not been able to resolve. Our network admin is looking into it but he's not sure why these users should be any different than the rest. Any suggestions?
View Replies !
Web Application And Role Management In Sql Server 2005
Hi every body I'm developing a web application and i like to use the sql server 2005 role management features istead of developing a role management package in my program, I can do it on my tables and othe database items but I have no idea about using database access rights in my web pages to permit some one viewing or updating a web form... Is there any system table or system stored procedure showing access rights in my data base? or is there another idea to do this?? by Thanks Javaneh
View Replies !
Management Studio
dont know y, but i have prob. installing MS Management studio....After a hard drive failure I was forced to reinstall everything... :( The problem is that after installing vs2005 proffesional edition I installed the sql server 2005 trial edition and everything was fine during the installation.When I looked for the Management studio it wasnt there for me :( I uninstalled and reinstalled trying the full installation but results was the same, no Management studio!!!After uninstalling the SQL server trial edition I installed the Management studio express and it works. except that from some reason I cannot browse my XP user folder which has no password protection.. :( Any idea for installing the SQL trial edition including the Management studio ???Why can't I browse my XP folder with Management studio express ???Where can I download Management studio (non express version)?? regards
View Replies !
Management Studio
Hi I am moving towards managing sqlserver databases and i basically come from a command line background. Can you please tell me some of the tasks that needs to be done using command line only in sqlserver and wherein management studio falls short. regards db2hrishy
View Replies !
Where Is Management Studio
I have been working this for 2 days on my XP SP2 machine, AHHHHH !! I tried running the SQL Server 2005 Tools install, and kept getting SQL configuration checker error with WMI. What finally got me around that was installing VS 2005. {without SQL Express} Ran the tools install, but not Management Studio, only the Configuration Tools on my menu. What the heck, tried running the full install, got the database engine, but still no Management Studio. Tried uninstalling everything, everything is gone except the database engine. Tried re-installing, still no luck. Tried the command line to fix the shortcut to management studio as detailed in the setup help file: setup.exe /qb REINSTALL=SQL_WorkBench REINSTALLMODE=S NO LUCK. This is absolutely crazy, what year is this. It's as if something the setup program see's on my machine is blocking the install of management studio.
View Replies !
Management Studio
Hello! What are the differences between "SQL Server 2005 Management Studio" and "SQL Server Management Studio Express"? I have an installation of SQL Server 2005 Standard Edition and can only find the Management Studio Express!? How can I install the "not-Express-version" ? Regards CSharpNewbie22
View Replies !
Management Studio
is there a way to deploy only the workstation tools? Can I create an msi or sms package to install only the tools I need for users to have? Can I lock down the interface so all options are greyed out other than workstation tools? thanks
View Replies !
Where To Get SQL Management Studio?
Hi Guys, I know my question looks very stupid but cant help. I got SQL Server 2005 Evaluation Copy along with Visual Studio 2005. I want to do some evaluation of Reporting Services. I am able to create reports from VS 2005 i.e. rdlc extension. and chaning the extension I can publish them to reporting server but I want to create reports with parameters which will be passed from UI form. On looking some resources i can to know that I will need SQL Server Management Studio to generate RDL reports. Where can i get Management Studio? Do i need to download it or need to purchase it? Thanks in Advance Hemant
View Replies !
|