Is @@rowcount And Scope_identity() Thread Safe?

Aug 23, 2007

Hopefully this is the right forum! Im guessing they both are since they return the values pertaining to the current scope. I don't want to use transactions when I dont have to. What do you guys think?

View 4 Replies


ADVERTISEMENT

Thread Safe Question On Insert

Sep 5, 2007

Assume in a table, I have a table structure which contains parentID and childID.

In my procedure to insert a child for example, I begin a transaction, do a select statement see how many children for the given parentID, if is more than 10 then don't insert , otherwise insert the new child in. Then commit the transaction.

I wonder how thread safe such code would be... Quite worry about data corruption.

If 2 threads both updating this table, and the select statement both return 9 children, so both of them think they can do the insert, so the parent will end up with 11 children. Is such scenario possible to occur? If so, how to solve it and make sure the code is thread safe?

Hope someone can give me some suggestions..

Thank you

View 10 Replies View Related

Driving SSIS Packages From ASP.NET Web Services...is It Thread-safe?

Jun 10, 2007

Our application drives SSIS packages from ASP.NET web services. To alleviate some of the package load time overhead application caches SSIS Application object and several instances of "pre-loaded" packages in ASP.NET Application context. As needed the code uses cached SSIS Application instance to execute "pre-loaded" packages. Is this thread-safe?

View 10 Replies View Related

Rowcount - Returning Rowcount From SSIS To A Vb.net App Executing The Dtsx Package

Jul 7, 2006

I have a vb.net application that executes a simple flat file to sql table dtsx package. I want to capture the rowcount to display back to the user to verify the number of rows that were inserted or updated to the table. I have a Row Count component placed between the flat file source(without errors) and the destination component. I have assigned a variable named RecordCount to the Row Count component. So far so good I hope : )

Now, I also use a variable to "feed" the package the flat file source. This works fine, but I cannot figure out how to retrieve the row count information and how to assign that to the variable RecordCount.

Also, if anyone has any insight on the way to work with the OnProgress method in SSIS I would appreciate that as well. In SQL 2000 using DTS I create a "PackageEventsSink" that I had found online, and it worked great for monitoring the progress of the DTS. Can't seem to figure out how to get it to work in SSIS.

Thanx,

Mike

View 11 Replies View Related

SQL LOJ Rowcount &&> SSIS MergeJoin Rowcount. Why?

Jul 25, 2007

In sql I perform the following
SELECT * FROM
xlsdci x LEFT OUTER JOIN fffenics f ON f.[derived deal code] = x.[manual dcd id]

which gives me a row count of 2709 rows


In SSIS I have a merge join component (left outer)
left input = xlsdci with a sort order of 1 ASC on [manual dcd id] (OLE DB source component)
right input = fffenics with a sort order of 1 ASC on [derived deal code] (OLE DB source component)

which when run in the IDE gives me a rowcount of only 2594 rows

Why is this so?

Also if I change the join to INNER in the merge join, the number of rows drops dramatically to only 802.
Fair enough, I hear you cry, maybe there are IDs in the 'xlsdci' table that are not in the 'fffenics' table. Ok. But the following SQL reveals that there are only 14 rows(IDs) in 'xlsdci' that are not in 'fffenics'

SELECT * FROM xlsdci
WHERE [manual dcd id] NOT IN (SELECT [derived deal code] FROM dbo.fffenics)

What is going on here?

View 5 Replies View Related

Run DTS In Safe Way.

Jul 23, 2005

I have two servers: progress as transational server and mssql as warehouseserver.I did DTS that "pumps" data from progress to mssql (via ODBC). Copying thedata has to be done once a day, but sometimes there is a need to do it onuser's demand.I'd like to ensure that I properly understood the method of running DTS I'vejust found using Google.As I can see, there are at least two methods (except of scheduling):- using dtsrun - which requires user running the DTS to have adminprivileges to use xp_smdshell- using sp_start_job - which requires creating a job prior to running theDTS.I think of using the second one as it seems to be more secure - am I right?Are there any hidden traps? What else should I do?--PL(remove "nie.spamuj.bo.w.ryj" from my email address)

View 2 Replies View Related

How Safe Is RS?

Apr 8, 2008

I am trying to persuade our security people to allow access to RS from external facing web sites. The web sites will talk to the SOAP interface over SSL so the firewall will need to open port 443 between the web server in the DMZ and the RS server inside the firewall.

Any credentials passed will be encrypted, so the main questions is around parameters to reports and the possibility of SQL Injection attacks. I need a white paper or other document that will convince them that RS will not allow SQL Injection or scripting attacks and properly validates parameters.

Does any such thing exist?

View 7 Replies View Related

SP & Source Safe

May 3, 2001

Can anyone tell me how I can copy store procedures from SQL Server 2000 to Source Safe 6.0? I right-click the store procedure and cop
y it but when I got to the visual source safe it will not work. I therefore went through the soruce code control on Tool menu which I cannot see such commands. I do really need your help.

Regards,

View 2 Replies View Related

SQL Connection : Is It Safe?

Oct 27, 2007

I've recently planned to make a program that uses remote MSSQL connection. I'm not such an expert in security.
Please can someone tell me if it safe? and how can I improve my security. I know how to block SQL injection, but me fear is that some will hack my software for personal use.

Thanks, RedEyez.

View 3 Replies View Related

Safe Way To Cast

Nov 29, 2007

I have a table that stores a value called "LocationNumber" as a varchar. I didn't create the database, I just use it. Anyway I usually sort the list by Casting the LocationNumber to an Integer. If I don't cast it, it trys to sort it lexiographically i.e. 0, 1, 21, 3, 345, 9 instead of 0, 1, 2, 3, 9, 21, 345.

It works 99.9% of the time, but the other 0.1% of the time it runs into some text that somehow made its way into the database field, and it causes an error.

Is there a way to safely cast a number in SQL? So that it just returns 0 when the value is not a number.

View 8 Replies View Related

Safe Columns Names

May 28, 2004

Hey,

I'm creating registration form.

To show fields names I thought to read columns names.

It's ok if columns is named like "Name", "Age" etc.
But if the columns is named [Country, Address, PostCode] then, I think, it can course some problems. Am I right?

First problem I thought about - changing database in the future (Now MS SQL 2k to MySQL etc.)

Is this the only problem?

To solve this I think using table which store syscolumn names as user defined columns names.

My system is speed critical and using this I would get less performance.

Which way should I go?

Case saving columns names in table, how to generate safe column name from user specified name, which can have special charters.

Thanks

View 6 Replies View Related

Source Safe And SQL Server 7.0

Oct 11, 2000

I'm in the process of locking down our SQL Server development environment and wanted to implement some type of version control, not just for stored procedures but for all database objects (tables, triggers, etc.)

A while back I read an article that explained how to utilize Visual Source Safe to establish version control for databases. If I recall correctly, I believe it had something to do with Visual Interdev and creating some project with Visual Interdev.

If anyone can provide alittle more insight into how to accomplish this, or at least point me in the right direction, it would be greatly appreciated.

Thank you in advance for your help!

View 3 Replies View Related

SQL-safe String Inserts

May 13, 2008

We have a VB.Net 2005 application that uses SQL CE 3.1 as its embedded database.

Frequently in the application, we must store strings with apostrophes, quotes, and all kinds of other stuff. It's totally unwieldy to try and manually escape every nonstandard character in every string... this is why we need to know how to handle this issue for all possible input.

What is the best method we can use to store any string, no matter what characters occur in it? The reason we must now improve our string handling is that we are now being required to store MD5 hashes of files for security and duplicate file avoidance, and these hashes usually break our import functions.


We normally enclose strings in single quotes ('). But, with the hashes as mentioned above, none of our current code works. Again: how can we be certain that the exact string we pass in will be stored in its current form, no matter what the characters?

THANKS

View 1 Replies View Related

Is WITH ENCRYPTION Now Safe In SQL2005?

Nov 5, 2005

Hi,has anybody knowledge about the safetyness of encrypting stored procs inSQL-Server 2005 using WITH ENCRYPTION? Or can they be hacked with the sameold tools which exists for SQL 2000?thanks,Helmut

View 7 Replies View Related

ActiveX Safe For Scripting

Jul 30, 2007

Can someone help

I create a activeX with c# .net 2005, and need that it be "safe for scripting", but I don't have examples for do it


help me please

thanks

View 1 Replies View Related

Multiple Instances Is It Safe And Secure ?

Feb 6, 2002

Hi everybody.
One of department want to place db application from one server somewhere else on corparation network for 3 month period.
Problem is they want to keep it with max security.
Company does not want set up another server , so we want to create another
Instance and place database on it.
1. Is safe to keep 2 instances on same server ?
2. How remove access to this instance from members of local and domain admin role(If we deny acces to BuildInAdministrators how it is going to affect security?)
Thank you

View 1 Replies View Related

SQL Profiler On A Prod System...is It Safe?

Jul 20, 2005

I have been using the index tuning wizard to review some of my stored procs,and views. So far most of my indexes have been set up well, but I am curiousas to how they would look under a production system load. I was thinking ofrunning a profile for about 30 minutes or so on the prod system, and thenusing that profile for the index tuning wizard to see what it says.Would this be of value?Can running a profile on a prod system be dangerous?--BV.WebPorgmaster - www.IHeartMyPond.comWork at Home, Save the Environment - www.amothersdream.com

View 2 Replies View Related

SQL2000 Toast But Ldf And Mdf Safe On Alt Drive

Feb 9, 2008



AD corrupt on RAID caused SBS 2003 to require reinstalling, no back ups.

Due to space constraints, database was attached to the D: drive so all is lost on the OS but the LDF and MDF files are safe on the other drive. Since a complete re-install of SBS 2003 is required I'm going to go with SQL 2005. How can I re-attach the old database to the new install?

Thanks in advance for any assistance,
Jeff

View 4 Replies View Related

Safe For Image-Based Deployment

Apr 16, 2008

My understanding is that Microsoft SQL Server 2005 (unlike SQL Server 2008) is NOT safe for image-based deployments or at least is not officially supported. Is anyone aware of what tasks need to be performed if an image-based deployment approach is taken?

I have Windows and SQL Server installed on HostA, and I want to create an image and install a copy of the image to HostB, HostC, and so on.

When the image has been restored to the target machine, I do the following:
1. Run NewSID.exe
2. Change Host Name
3. Change IP Address
4. Change the SQL Server sysservers table via sp_addserver.

I noticed that the SQL Server installation program has created sevral Windows groups and SQL Server has several logins, users, and schemas with names associated with the source machine, HostA.

My question are: What are these accounts used for? Can or should they be renamed (this shouldn't affect the SIDS, right)? Is there anything else that requires changing? Can this be automated? What "gotchas" should I look for? Or is this simply not "doable"?

Any help/guidance is appreciated!


View 1 Replies View Related

Is It Safe To Upgrade OS From 2000 To 2003 Without Testing???

Oct 6, 2005

I have always upgraded the OS on test servers before upgrading on production. We are in the process of upgrading hardware for a production server and are considering installing Windows Server 2003 Standard Edition vs. what previously existed on the server, Windows 2000 Standard Edition. How much of a risk would this present? I'm leaning towards not changing the OS until we have a chance to upgrade the test servers first.

Dave

View 2 Replies View Related

Visual Source Safe Admin Question

Jan 3, 2007

Hi - I am wondering if anyone can give me good advice on the following situation:

I'm a new employee at a place where the SQL Server/Visual Source Safe admin has left. Only his co-worker has a VSS account and the VSS admin never gave her the admin p/w and he cannot be contacted. We need to have an account set up for me.

My question is: How can this be done with the knowledge of the admin p/w? Would we have to backup the files, un-install VSS, re-install it and set up the admin account again, or have I answered my own question? Or are we screwed? I don't have enough experience with VSS to make a decision.
At this point we're considering calling "Geek Sqaud" or "Geeks on Call", etc.

Thanks for any suggestions?

View 4 Replies View Related

Setting Up SQL Server 2005 With Source Safe

Jul 17, 2006

My manager has asked me to install and configure Source Safe so that our team can check out stored procedures, (and other objects), and check them back in when we are finished working on them.

I'm not familiar with Visual Source Safe. Does SQL Server 2005 work with Visual Source Safe in such a way that I can check out/in SQL Server objects such as procedures?

If someone knows the answer, or perhaps an existing thread that covers this, please let me know.

Thank you for your time!

Frank

View 1 Replies View Related

Team Foundation Server Vs Source Safe

Apr 3, 2006

Can someone give some comments on which program to use with SSIS ?

View 2 Replies View Related

Stored Procedures In Visual Source Safe

Nov 15, 2007



I have about 40 stored procedures in a Visual Source Safe stored procedures which we are using for change control.

All stored procedures require to be moved into production across at least 13 different databases each on a dedicated server.

The only way I know at the minute is to do this manually. Does anyone out there have any ideas of how this task can be automated?

View 9 Replies View Related

Reporting Services :: Turn Off ViewState Safe?

Oct 6, 2006

Would turning off ViewState in Report Manager be safe?  Or at least is there a way to deactivate ViewState for viewing reports in Report Manager instead of all pages in the web site?

I'm not sure of the impact of deactivating this with the internals of the web application. 

View 2 Replies View Related

Is It Safe To Use Volume Mount Points With SQL 2005?

Jul 20, 2006

Hello,

To implement the new SQL 2005, I plan to make the environment easy to manage. The environment should be simple to document and be automated via scripts. Therefore I plan to use mount points as described below.

On a typical SQL server with multiple drives like C, D, E, F, G, H. Where each drive will have various folders to hold SQL code, data files, transaction log files, tempdb files, snapshot files, and other types of files. This typical environment is not pretty and is hard to write scripts for.

So I plan to standardize on one standard directory structure via volume mount point. On all new SQL 2005 servers, we should see drive E as the one and only SQL Server directory. Other drives will be mounted to drive E as shown.

E:

SQLSERVER local folder -sql code for each db instance

SQLSHARED local folder -sql shared tools for all db instances

SQLTLOG1 Drive H -db transaction log

SQLSNAP1 Drive F -db snapshot files

SQLTEMPDB1 Drive H -tempdb main data file

SQLWORK Drive D - DBA work area

SQLDATA1 Drive G -db data files

SQLDATA2 Future Drive -if SQLDATA1 is too large for any direct attached drive, or to get more I/O throughput.

With this implementation, I can easily write scripts to manage the environment. Also if any mounted volume is out of space, we can swap the based drive without doing any change to database configuration. We can also switch from direct attached drive to SAN in the future.

Do you think mount point is safe to use with SQL 2005? I know it is supported.

Do you have a standard directory structure for your environment? How do you do it?

Thanks,

KTMD

View 2 Replies View Related

Using Scope_identity

Oct 20, 2007

Using scope_identity
I am using SQL2005 and I need to insert a record and return ID. I am using scope_identity() in the stored procedure to return the ID for the record just inserted.
Do you see any problem with this when it comes to multi-user and multi-threaded environment.
 

View 6 Replies View Related

Help On Scope_identity

Jan 3, 2008

Hi, i  need the DiagnosisID from the Diagnosis table to be copied and insert it into DiagnosisID from DiagnosisManagement. I was told to use scope_identity(), but i'm not sure how to implement it. Below is my code behind in vb.net. pls help. Dim cmd1 As New SqlCommand("insert into Diagnosis(TypeID, SeverityID, UniBilateral, PatientID, StaffID) values ('" & typevalue & "','" & severityvalue & "','" & unibivalue & "','" & Session("PatientID") & "','" & Session("StaffID") & "')", conn)        cmd1.ExecuteNonQuery()        Dim i As Integer        For i = 0 To hearingarray.Count - 1            Dim li As New ListItem            li = hearingarray(i)            Dim cmd As New SqlCommand("insert into DiagnosisManagement(ManagementID) values ('" & li.Value & "')", conn)        //i need the DIagnosisID from the Diagnosis table to be copied and insert it into DiagnosisID from DiagnosisManagement here            cmd.ExecuteNonQuery()        Next

View 1 Replies View Related

Using SCOPE_IDENTITY()

May 19, 2008

Hi All,
I'm trying to return the last id entered via the following code, and I'm only getting '0' back.
 1 using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString))
2 {
3 connection.Open();
4 using (SqlCommand command = new SqlCommand("REG_S_CustomerIDFromPhoneNumber", connection))
5 {
6 command.CommandType = CommandType.StoredProcedure;
7 command.Parameters.AddWithValue("@Mobile_Telephone", MobileNumber);
8
9 int test = Convert.ToInt32(command.ExecuteScalar());
10
11 Response.Write(test.ToString());
12
13
14 }
15 } My SP is as follows (I'm trying to use one that's already been written for me) 1 SET QUOTED_IDENTIFIER ON
2 GO
3 SET ANSI_NULLS ON
4 GO
5
6
7
8 ALTER PROCEDURE [dbo].[REG_I_CreateBlankCustomer]
9 @Mobile_Telephone varchar(255),
10 @CustomerID int OUTPUT
11
12 AS
13
14 INSERT INTO Customer (Mobile_Telephone)
15 VALUES (@Mobile_Telephone)
16
17 --SET @CustomerID = @@Identity
18 SELECT SCOPE_IDENTITY();
19
20
21 GO
22 SET QUOTED_IDENTIFIER OFF
23 GO
24 SET ANSI_NULLS ON
25 GO
26
27
28
 

 when I'm running this via Query Analyser, I get the ID returned correctly, however as mentioned when ran via that code above - I get a 0 outputted to me.  What am I doing wrong?
 
Thanks!

View 9 Replies View Related

Where To Put This SCOPE_IDENTITY

Jun 9, 2008

i have such a stored procedure.
 
but i dont know where to put that scope_identity to retrieve a value.
 SELECT SCOPE_IDENTITY() AS [@Car_id]
GO
ALTER procedure [dbo].[insertuser](
@Make nchar(10),
@Model nchar(10),
@SellerID varchar(50),
@MileAge nchar(10),
@Year_Model int,
@Price money,
@Date_added datetime,
@Thumb_ID varchar(50),
@Image_id varchar(50),
@Car_id int
)
AS
INSERT INTO
dbo.tbcar
VALUES(@Make,@Model,@SellerID,@MileAge,@Year_Model,@Price,@Date_added);
 
 
INSERT INTO
dbo.tbimages
values
(@Thumb_ID,@Image_id,@Car_id)

View 5 Replies View Related

SCOPE_IDENTITY() Help

Mar 30, 2005

I was wondering if its possible to use this function if your using a
SqlDataReader where I just run a stored procedure that just inserts a
row?

View 2 Replies View Related

SCOPE_IDENTITY()

Mar 31, 2006

Hello altogether, my problem ist that I get following error message:
Create Stored ProcedureUnable to chances to the stored procedure.Error Details:'Scope_Identity' is not a recognized function name.
This is my Stored Procedure:
CREATE PROCEDURE sp_HyperSoftCustomer   @Name varchar(25),   @Adress varchar(250)as    insert into HyperSoftCustomer(Name, Adress, Date)    values (@Name, @Adress, GetDate())     Select SCOPE_IDENTITY() GO
I am using MSDE  -  MSSQLServer
I hope there is anybody who can help me?
Thanks, mexx

View 3 Replies View Related

Scope_identity From Vwd VB

Jun 3, 2006

I have seen plenty of messages about using scope_index by creating parameters using HTML but I would like to do it from my .aspx.vb page.
Does anybody know if this is possible? I have got as far as the code below and get stuck when trying to add a new parameter with direction of output.
Any help would be much appreciated, cheers,
Doug.
Dim NewProperty As SqlDataSource = New SqlDataSource
NewProperty.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectIt").ToString()
NewProperty.InsertCommand = "INSERT INTO Test (Name) VALUES (@Name); SET @NewID=SCOPE_IDENTITY()"
NewProperty.InsertParameters.Add(NewID, id)
NewProperty.Insert()

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved