StoredProc For Checking For Duplicates And Then Updating The Data.

Mar 22, 2008

Hi

I have a question i hope someone here will solve my problem.

I need a storedproc for checking the duplicates before updating the data.

here i need to pass four parameters to storedprocedure which must be updated with existing row.

but before updating the values. Storedproc should check for 2 colum values in all rows.

if same combination of colum values is present in any other row then the present rows which we tring to update should not be

updated. Can anyone help me with this.

Thankyou verymuch.

View 8 Replies


ADVERTISEMENT

How To Set User Who Can't Modify Any StoredProc And Data In Tables But Can Read Data In Tables And Any StoredProc ?

Jul 13, 2007

Please give me advise ครับ
 

View 1 Replies View Related

Best Way To Add To DB While Checking For Duplicates

Jul 23, 2005

Situation:Day 1Table contains 100 items of actions imported via FTP. One of the fieldsin the table can be updated to reflect an assigned unit code.Day 2Actions that may be duplicates of the table from Day 1 (with theexception of the updated assigned unit field) are imported forinclusion in the Table from Day 1.Question- What is the best way to insure that any new items are addedto the table and that no duplicates are added at the sametime?Assistance would be appreciated.

View 1 Replies View Related

If Statement Checking For Duplicates???

Jul 2, 2007

I'm wanting to create a if statement that will query a table and check for a duplicate and if there is a duplicate return that uniqueID or if it doesnt find a duplicate continue to add a new record...so here is my question is there a way to run a if statement that will call a function (lets say a function that returns like a bool) and if it finds a duplicate grab that id and store it in a session.....i guess my question is how do i query the database for a record and if found return true if not return false....that is my question....

View 9 Replies View Related

Checking For Duplicates In A Table

Aug 6, 2014

how i can check for duplicate entries for example if a serial number has already been inputted and a user tries to input the same serial number.. how can i get a trigger or some sort to check for duplicates and then prompt that the number has already been entered.

View 7 Replies View Related

SQL Server 2012 :: Updating Table2 By Checking Table1

Apr 23, 2014

I want to update table2 by checking table1.

if trauma has atleast 1 then clm2 in table2 would be 1
if infec has atleast 1 then clm2 in table2 would be 2

table1

Clm1 Clm2
Trauma 1
Trauma 1
Trauma 1
Infec 2
Infec 2
Trauma Null

table2

clm1 clm2
Trauma 1
infec 2

I have to update table2 based on table one ny checking multiple columns.

View 2 Replies View Related

Updating A Table By Both Inserting And Updating In The Data Flow

Sep 21, 2006

I am very new to SQL Server 2005. I have created a package to load data from a flat delimited file to a database table. The initial load has worked. However, in the future, I will have flat files used to update the table. Some of the records will need to be inserted and some will need to update existing rows. I am trying to do this from SSIS. However, I am very lost as to how to do this.

Any suggestions?

View 7 Replies View Related

T-SQL (SS2K8) :: Rank Duplicates But Only Rows Involved In Duplicates?

Oct 22, 2014

I have a table with 22 million Business records. I can see that there are duplicates when I group by BusinessName and Address and Phone. I'd like to place only the duplicates into a table, with a ranking, oldest business key gets a ranking of 1.

As a bonus I'd like each group to have a distinct group name (although not necessary, just want to know how to do this)

Later after I run more verifications to make sure these are not referenced elsewhere I'll delete everything with a matchRank > 1 out of the main Business table.

DROP TABLE [dbo].[TestBusiness];
GO
CREATE TABLE [dbo].[TestBusiness](
[Business_pk] INT IDENTITY(1,1) NOT NULL,
[BusinessName] VARCHAR (200) NOT NULL,
[Address] VARCHAR(MAX) NOT NULL,

[code]....

View 9 Replies View Related

Data Checking?

Jul 23, 2005

Hey all,prolly a simple solution, but why isn't the following string working inmy execute sql step within DTS? It produces results, just not the onesI want... What am I doing wrong?select x from new_files where x like '%[^0-9]%' and x like '%[^a-z]%'It's displaying all the records? It should only be displaying thoserecords that do *not* contain letters or numbers.Thanks in advance!-Roy

View 3 Replies View Related

Checking For No Data To Display

Oct 30, 2007

I am using a filter in a matrix control. I would like to display a "No data" type message if no data is present. The problem I'm running into is the base query is returning data, but the optional filter is removing all rows from display.

So using CountRows in the base dataset doesn't quite cut it. Is there an alternative?

View 4 Replies View Related

Copy Data To SQL Server By Checking (available)

Oct 1, 2001

Hello,

I connect from SQL Server on Windows 2000 to Progress
Database on UNIX.
The database name of SQL Server is cstarsql and the
name is cstarint on UNIX.

I would like to schedule to copy data from
cstarint(Progress) to cstarsql(SQLServer). I did for
one time, but I want to control if the data has
already copied or not. If not, it will copy.

In DTS Query Builder to copy from Progress to SQL
Server,
SELECT * from calls WHERE call_date = TODAY
The name of table of calls is the same for both
database.The above calls is cstarint(Progress
Database)
This command is enough for one time. But I need to
control if the record has already copied.


In SQL Server, I control if the record is available or
not with @@FETCH_STATUS .
Now I would like to mix two queries, but I couldn't.
Can anybody do this?

DECLARE calls_cursor SCROLL CURSOR
FOR SELECT * FROM calls
WHERE call_date = TODAY

OPEN calls_cursor

-- Perform the first fetch.
FETCH NEXT FROM calls_cursor

-- Check @@FETCH_STATUS to see if there are any more
rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch
succeeds.
FETCH NEXT FROM calls_cursor
END

CLOSE calls_cursor
DEALLOCATE calls_cursor

Alice

View 1 Replies View Related

Checking Out Data To Client Users

Sep 29, 2006

I'm trying to resolve an issue that I've run into in my current system.

I have about 10 clients accessing a SQL Server several times per minute (every 10-20 seconds). To have an individual find the next record, I follow the following process:

1. Select the value of the next record in the database to be checked out.
2. Update the record to show that it is checked out to the user.
3. Select the data in the record to display to the user.
3. Update the record to show any changes and to check the record back in after the user edits it.

My issue is that clients can execute at the same time. Right now, with just SQL statements, two clients can get the same value in step #1. That makes them select the same record for editing. Can I use T-SQL to prevent this from happening? If I use a transaction, will the SQL Server 2005 queue up the transactions, or could I still get the same problem of opening up the same record?

Thanks!
Drew

View 3 Replies View Related

Checking Data And Emailing The Results....

Jun 28, 2006

Hello,
 
I am trying to use €œSQL Server Business Intelligence Development Studio€? (what is the short name for this) to complete a check and then possibly email me depending on what happens.
 
The check is around two tables that I have. There is a chance that they will become out of sync with each other and so I want to know when a field (ACCOUNTID) has a value that is in one table and not the other. I can do the check but I would like the package to email me when there is a problem (and if possible email me the details) and do nothing when everything is OK.
 
Can anybody give me some hints to point me in the correct direction as I just seem to be chasing my tail at the moment,
 
Thanks,

View 5 Replies View Related

Importing Of Data, Resulting In Duplicates, HELP!

Oct 18, 2004

hi all,

I have a problem with SQL 2000 here...
I juz imported the same set of data to my database table and it gave me duplicated records as all the data is imported although there is same existing data.

Can anyone help me with this?
How can i import the data such that the data which already exists in the database will not be imported in again?

Thanks in advance.

View 4 Replies View Related

Data Transfer With Possible Duplicates In Target

Feb 7, 2007

I need to copy data from 3 tables in one database into another db. The destination db already contains some data and it is expected that there will be duplicates which we do not want to have copied across (I think there is a constraint that prevents duplicate email addresses which is our main search field)

The three tables are effectively a user table, an address table, and a [phone] numbers table, each of which has an auto generated id field. The user table also maintains a reference to the address and numbers tables.

We are using SQL Server 8 (SP3) and it has been suggested that I use the data transformation service (DTS) tool which I have used numerous times to copy entire databases, but I can't figure this bit out.

I am still learning t-sql using SQL Query Analyzer, but have been doing so for a while and think that I'm fairly competent in it. My main question is this: Is it possible to connect to two DBs at the same time in SQL QA? If so, I'm pretty sure that I could work out how to pass the data across, I'd just need to know how to connect to them both.

Any help would be much appreciated. If you need any more information to help, please let me know.

Thanks,

Stephen

View 2 Replies View Related

Import Data Minus Duplicates

Feb 20, 2008

Hi

I am currently trying to import data from a table in 1 database into a table of the same name in another database. This in it's self is simple, however to add a twist to the proceedings there is data that exists in both tables. I just want to import the data that doesn't exist in the table I am importing into.

Please can you advise as to the best method to use

Many thanks

Paul

View 5 Replies View Related

Appending Data To A Table But Not Duplicates

Jul 23, 2005

Hiya everyone,I have two tables in SQL 2000. I would like to append the contents ofTableA to TableB.Table A has around 1.1 Million Records.Table B has around 1 Million Reocords.Basically TableA has all of the data held in TableB plus 100,000additional records. I would only like to import or append these newadditional records. I have a unique index already setup on Table B.Any ideas pretty pretty please?Paul.Ps. (Have been messing around with DTS but get a unique violation error- Which is kinda what I want I guess, but would like SQL to ignore theerror and only copy the new data - if only)

View 9 Replies View Related

Converting Duplicates Records Into Non Duplicates?

Jan 26, 2015

Is there a query or a way to convert duplicates value in a column to non duplicates.

View 14 Replies View Related

Possible To Disable Welll-formedness Checking When Inserting XML Data.

Mar 20, 2006

Hi All,Can anyone help with the following problem? I have a database whichcontains a table with a 'text' field, and the text field contains anxml document - typically 50-100K. Now I'd like to make use of SQLServer 2005s XMLData type. To do this I have created a new field ofthe 'xmldata' datatype, and run an SQL statement to update the contentsfrom one field to another - hoping to end up with a complete table ofxml (based on the old text field).The problem I have is after a minute or so, it must come across anbadly-formed xml fragment because I get the following message:Msg 9436, Level 16, State 1, Line 1XML parsing: line 1, character 67640, end tag does not match start tagCan I turn off the checking during the update, or is it not possible toadd badly formed data to the xmldata field. Any help appreciated asthe table runs into tens of thousands of rows, so I can't really checkthe contents of each!Many thanks,Duncan.

View 1 Replies View Related

Storedproc (again Sorry)

Feb 4, 2007

I get a execption when i run my code i dont know how to debug sql statements so ya could any one give me adive heres the code  public static int CreateMember(string username, string aspApplicationName)
{
int returnvalue = 0;
DateTime dateCreated = DateTime.Now;

// All users are added to users role upon registration.
Roles.AddUserToRole(username, "Users");

String connectionString = ConfigurationManager.ConnectionStrings["SqlConn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
SqlCommand command = null;
try
{
conn.Open();
command = new SqlCommand("InsertMember", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@AspNetUsername", username));
command.Parameters.Add(new SqlParameter("@AspNetApplicationName", aspApplicationName));
command.Parameters.Add(new SqlParameter("@DateCreated", dateCreated));
SqlParameter sqlParam = command.Parameters.Add("@Id", SqlDbType.Int);
sqlParam.Direction = ParameterDirection.ReturnValue;
command.ExecuteNonQuery();
returnvalue = (int)command.Parameters["@id"].Value;
conn.Close();

}
catch (Exception ex)
{

}
finally
{
if (command != null)
command.Dispose();
if (conn != null)
conn.Dispose();
}
return returnvalue;
}  i get a exception at command.ExecuteNonQuery(); and if i dont do int returnvalue = 0; it says i cant use it cause it hasnt be initialized or something like that ALTER PROCEDURE [dbo].[InsertMember]    @AspNetUsername nvarchar(256),    @AspNetApplicationName nvarchar(256),    @DateCreated smalldatetime = getdateASDECLARE @Id int;SET NOCOUNT ON;INSERTINTO [Members] ([AspNetUsername], [AspNetApplicationName],[DateCreated]) VALUES (@AspNetUsername, @AspNetApplicationName,@DateCreated);SET @Id = @@IDENTITYSELECT  @Id  AS [Id] theres my stored proc any ideas?

View 5 Replies View Related

.net StoredProc

Nov 28, 2005

Hi,

View 7 Replies View Related

SQL Server 2014 :: Best Design For Multiple Validation Checking Of Data

Sep 17, 2015

I want to do something with error checking in my company. For this we have a selection of different tables and the data needs to meet various validation rules else it is classed as an error.

To deal with this I'm currently thinking of this approach:

1. Create a view pulling all of the various data together from the multiple tables.
2. Create an empty 'errors' data table.
3. Create an Excel file with a button to call a Check for Errors Script

Then in the the script:

1. Clear the 'errors' data table
2. Call multiple scripts, each of which uses the new view, applies the checks for that specific error and writes any erroring data into the 'errors' data table (along with a text string with the unique error code for filtering / sorting purposes).
3. After calling all the scripts, the table can be refreshed in excel when when used with a pivot table can show the various errors, and let us drill down into all the data so we can fix them.

Also.. Ideally, I'd like some way to write comments in an excel column for each entry and error code and be able to write that back into a comment table.

View 5 Replies View Related

Return XML From SQL StoredProc

Apr 21, 2005

Hallo

I have a normal "Select * from Table" SP that have OUTPUT parameters as well.

Is it possible to obtain the result into a XML format and ALSO obtain the OUTPUT parameters in .Net1.1

Thank you

View 6 Replies View Related

Tool For Generating StoredProc

Jul 9, 2001

Hi,

I'm using SQL Server 2000 as our back end. I'm finding it bit difficult to write StoredProcs manually to be called from my front end. Is there any good Stored Proc generator tool available?

Thanks,
Harish

View 1 Replies View Related

Execute Xp_cmdshell And Other SA Storedproc

Mar 8, 2004

Hi all,

I have to execute stored procedures containing
xp_cmdshell and certain system storedprocedures in msdb and master
with a user who is not SA.
(i.e iam able to execute stored procedures when i log as sa,
but any other user cannot run them)

Pls tell how to do this, it is quite urgent.

View 1 Replies View Related

Storedproc For Wildcard Search

Mar 24, 2008

Hi someone please help me.

i have a serach page which have 4 textboxes.
passing this textboxes as parameters to storedproc iam searching the value.
filling atleast one textbox should fetch the value.

i have stored proc for searching it using normal column values but i want it do using wildcard search also.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go



ALTER PROCEDURE [dbo].[search1]
(@val1 varchar(225),
@val2 varchar(50),
@val3 varchar(50),
@val4 varchar(50))
AS
BEGIN

DECLARE @MyTable table (CNo varchar(255))



INSERT @MyTable

Select CNo From customer where
((@val1 IS NULL) or (CNo = @val1)) AND
((@val2 IS NULL) or(LastName = @val2)) AND
((@val3 IS NULL) or(FirstName = @val3)) AND
((@val4 IS NULL) or(PhoneNumber = @val4))



--Now do your two selects

SELECT c.*
FROM customer c
INNER JOIN @MyTable T ON c.CNo = T.CNo
Select r.*
From refunds r
INNER JOIN @MyTable t ON r.CNo = t.CNo
END

I WANT THE SEARCH TO BE DONE FOR WILD CARD CHARACTERS ALSO.

if the user enters lastname s*

using same storedproc can i insert wildcard search.

how can i do that please some one help me.

thanks

renu

View 1 Replies View Related

Copy Raw Data From A Flat File To A Database Table, BUT Do Not Insert Duplicates

Aug 2, 2007

Hi,

I'm new to SQL Server 2005 SSIS. I'm trying to do something very simple, but I cannot figure it out, PLEASE HELP!

I have a flat file, which I read and then insert the data in a database table, that works fine. The problem is that I don't want to insert duplicate records. For example; if I run the package again, it will appent to the table. What I need to do is that if the package runs again, check if the record already exist, based one two columns, date and hour, and do not insert the record.

Thank you,

Aldo

View 1 Replies View Related

Problem With Sql2005 Query/storedproc

Oct 2, 2006

I am working on the login portion of my app and am using my own setup for the moment so that I can learn more about how things work.  I have 1 user setup in the db and am using a stored procedure to do the checking for me, here is the stored procedure code:ALTER PROCEDURE dbo.MemberLogin(@MemberName nchar(20),@MemberPassword nchar(15),@BoolLogin bit OUTPUT)ASselect MemberPassword from members where membername = @MemberName and memberpassword = @MemberPassword if @@Rowcount = 0beginselect BoolLogin = 0returnendselect BoolLogin=1/* SET NOCOUNT ON */ RETURNWhen I run my app, I continue to get login failed but no error messages.  Can anybody help?  Here is my vb code:Dim MemberName As StringDim MemberPassword As StringDim BoolLogin As BooleanDim DBConnection As New Data.SqlClient.SqlConnection(MyCONNECTIONSTRING)Dim SelectMembers As New Data.SqlClient.SqlCommand("MemberLogin", DBConnection)SelectMembers.CommandType = Data.CommandType.StoredProcedureMemberName = txtLogin.TextMemberPassword = txtPassword.TextDim SelectMembersParameter As Data.SqlClient.SqlParameter = SelectMembers.CreateParameter'NameSelectMembersParameter.ParameterName = "@MemberName"SelectMembersParameter.Value = MemberNameSelectMembers.Parameters.Add(SelectMembersParameter)'PasswordDim SelectPasswordParameter As Data.SqlClient.SqlParameter = SelectMembers.CreateParameterSelectPasswordParameter.ParameterName = "@MemberPassword"SelectPasswordParameter.Value = MemberPasswordSelectMembers.Parameters.Add(SelectPasswordParameter)Dim SelectReturnParameter As Data.SqlClient.SqlParameter = SelectMembers.CreateParameterSelectReturnParameter.ParameterName = "@BoolLogin"SelectReturnParameter.Value = BoolLoginSelectReturnParameter.Direction = Data.ParameterDirection.OutputSelectMembers.Parameters.Add(SelectReturnParameter)If BoolLogin = False ThenMsgBox("Login Failed")ElseIf BoolLogin = True ThenMsgBox("Login Successful")End IfEnd SubThank you!!!

View 3 Replies View Related

StoredProc Insert Into Composite Key Table

Dec 23, 2005

I have three tables that are important here, a 'Plant' table a 'Spindle' table and a 'PlantSpindle' table. The 'PlantSpindle' is comprised of a PlantID and a SpindleID acting as the Primary Key for the table with no other fields.

I have an aspx page that captures the appropriate data to create an entry in the Spindle table. Depending on the user, I will know which plantID they are associated with via a querystring. In my storedproc I insert the data from the webform into the Spindle table but get stuck when I try to also insert the record into the PlantSpindle table with the PlantID I have retrieved via the querystring and the SpindleID of the spindle record the user just created. Basically, I am having trouble retrieving that SpindleID.

Here is what I have in my storedProc (truncated for brevity).

CREATE PROCEDURE [dbo].[InsertSpindle]
@plantID int,
@spindleID int,
@plantHWG varchar(50),
@spindleNumber varchar(50),
@spindleDateInstalled varchar(50),
@spindleDateRemoved varchar(50),
@spindleDurationMonths float(8),
@spindleBearingDesignNumber int,
@spindleArbor varchar(50),
@spindleFrontSealDesign varchar(50),
@spindleFrontBearing varchar(50),
@spindleRearBearing varchar(50),
@spindleRearSealDesign varchar(50),
@spindleNotes varchar(160)

AS
SET NOCOUNT ON
INSERT INTO Spindle
(plantHWG, spindleNumber, spindleDateInstalled, spindleDateRemoved, spindleDurationMonths,
spindleBearingDesignNumber, spindleArbor, spindleFrontSealDesign, spindleFrontBearing,
spindleRearBearing, spindleRearSealDesign, spindleNotes)
VALUES
(@plantHWG, @spindleNumber, @spindleDateInstalled, @spindleDateRemoved, @spindleDurationMonths,
@spindleBearingDesignNumber, @spindleArbor, @spindleFrontSealDesign, @spindleFrontBearing,
@spindleRearBearing, @spindleRearSealDesign, @spindleNotes)

SET @spindleID = (SELECT @@Identity
FROM Spindle)

INSERT INTO PlantSpindle
(plantID, SpindleID)

VALUES
(@plantID, @SpindleID)

I have guessed at a few different solutions but still come up with Procedure 'InsertSpindle' expects parameter '@spindleID', which was not supplied when I execute the procedure.

Any help would be appreciated! thanks!

View 8 Replies View Related

Aaargh! Storedproc Vs SQL In Gridview Update

Jan 26, 2006

When I attempt to update using a stored procedure I get the error 'Incorrect syntax near sp_upd_Track_1'. The stored procedure looks like the following when modified in SQLServer:
ALTER PROCEDURE [dbo].[sp_upd_CDTrack_1]
(@CDTrackName nvarchar(50),
@CDArtistKey smallint,
@CDTitleKey smallint,
@CDTrackKey smallint)
AS
BEGIN

SET NOCOUNT ON;
UPDATE [Demo1].[dbo].[CDTrack]
SET [CDTrack].[CDTrackName] = @CDTrackName
WHERE [CDTrack].[CDArtistKey] = @CDArtistKey
AND [CDTrack].[CDTitleKey] = @CDTitleKey
AND [CDTrack].[CDTrackKey] = @CDTrackKey
END
But when I use the following SQL coded in the gridview updatecommand it works:
        "UPDATE [Demo1].[dbo].[CDTrack]
   SET [CDTrack].[CDTrackName] = @CDTrackName
 WHERE [CDTrack].[CDArtistKey] = @CDArtistKey
   AND [CDTrack].[CDTitleKey]  = @CDTitleKey
   AND [CDTrack].[CDTrackKey]  = @CDTrackKey"
Whats the difference? The storedproc executes ok in sql server and I guess that as the SQL version works all of my databinds are correct. Any ideas, thanks, James.
 

View 2 Replies View Related

How To Get A Recordset In ASP From StoredProc Using Temp Tables ?

Mar 2, 2000

Hi!

The problem that I'm dealing with is that I can't get recordset from SP, where I first create a temporary table, then fill this table and return recordset from this temporary table. My StoredProcedure looks like:

CREATE PROCEDURE MySP
AS
CREATE TABLE #TABLE_TEMP ([BLA] [char] (50) NOT NULL)
INSERT INTO #TABLE_TEMP SELECT bla FROM ……
SELECT * FROM #TABLE_TEMP


When I call this SP from my ASP page, the recordset is CLOSED (!!!!) after I open it using the below statements:

Set Conn = Server.CreateObject("ADODB.Connection")
Baza.CursorLocation = 3
Baza.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=IGOR;Data Source=POP"


Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "MySP", Conn, , ,adCmdStoredProc

if rs.State = adStateClosed then
response.Write "RecordSet is closed !!!! " ‘I ALLWAY GET THIS !!!!
else
if not(rs.EOF) then
rs.MoveFirst
while not(rs.EOF)
Response.Write rs ("BLA") & " 1 <br>"
rs.MoveNext
wend
end if

end if

Conn.Close


Do you have any idea how to keep this recordset from closing?
Thanks Igor

View 2 Replies View Related

Oracle StoredProc/Job Running At SQL Server?

Feb 5, 2003

Hi,
Is it possible Oracle Stored Proc or Jobs able to schedule in sql job?.
Thanks,
Ravi

View 3 Replies View Related

Testing StoredProc With GUID Parameter

Apr 11, 2002

I am working revising a number of stored procs on a system which has suffered some schema changes.

Sometimes I can test my SP code passing in a guid without a problem. Example below:

Test Command:

EXEC usp_Unit_INSERT
'{74A1BABA-0B76-4436-B6AA-01716B686044}', --unitguid
'36', --91', --UnitNumber (varchar)
10, -- xxHospitalNumber
'testUnknown' --UnitName

Above works fine.

I am testing another similar stored proc and am getting this error:

Server: Msg 8152, Level 16, State 9, Procedure usp_Patient_Info_INSERT, Line 24
String or binary data would be truncated.
The statement has been terminated.

(Line 24 performs an insert to a GUID)

Pertient code portions below.
Can anybody shed any light. I am essentially doing nearly identical things to another Stored Proc which works just fine.

Code below fails with above error, but is virtually identical in how it treats all GUID fields to another which does work fine.

-------------------------------------------------
CREATE PROCEDURE [usp_Patient_Info_INSERT]
@PatientGUID varchar(40),--uniqueidentifier,
@PersonGUIDvarchar(40),--uniqueidentifier ,
@CaseNumberdecimal(10,0),
<< and so forth >>

AS
IF @PatientGUID Is Null
SET @PatientGUID =cast( (newid()) as varchar(40))

INSERT INTO [Patient_Info] (
PatientGUID,
PersonGUID,
CaseNumber,
<< and so forth >>

Values (
cast( @PatientGUID as uniqueidentifier),
cast( @PersonGUID as uniqueidentifier),
@CaseNumber,

<< and so forth >>

View 1 Replies View Related







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