Confuse On Stred Prcedure
Mar 16, 2007
Hi everyone.
What is meant by stored procedure?
DECLARE @newyear int ]
set @newyear = 2007 ]----> is it a stored procedure?
what about the CSVTable? is CSVTable a stored procedure?
Thanks. Im just confused.
-Ron-
View 3 Replies
Jul 12, 2005
I'm trying something new, and have hit a snag.
basically, I'm attempting to use two INSERT commands in a single SP. I want to use the PK from the new entry and apply that to the second.
here's the code;
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::
CREATE PROCEDURE spInsertNewUser
@fn varchar(50),
@ln varchar(50),
@add varchar(50),
@add2 varchar(50),
@ct varchar(50),
@cty varchar(50),
@st varchar(4),
@pc varchar(50),
@ph varchar(50),
@cp varchar(50),
@fx varchar(50),
@em varchar(50),
@pw varchar(50),
@uid varchar(50),
@rc bit,
--@indentity int OUTPUT,
@cid int
AS
SET NOCOUNT ON
INSERT INTO tblUserInfo
(
firstName,
lastName,
address,
address2,
city,
county,
state,
postalCode,
phone,
cellPhone,
fax,
email,
pword,
userUID,
regConfirmed
)
VALUES (
@fn,
@ln,
@add,
@add2,
@ct,
@cty,
@st,
@pc,
@ph,
@cp,
@fx,
@em,
@pw,
@uid,
@rc
)
SELECT @@IDENTITY FROM tblUserInfo
--SET @indentity = @@IDENTITY
INSERT INTO tblUserToCountySubscribedLKP (
UserID, CountyID
) VALUES(
@@indentity, @cid
)
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::
I'm sure the problem is largely due to the fact that I am close to completely clueless on such things, but a bit of timely advice from the sage sql wizards here would be most welcome and greatly appreciated.
View 5 Replies
View Related
Aug 3, 2007
hi focks;
through the jobs is possible it s working fine but
is it possible to run the packages through the stired procedure 2005
ok if possible how please help me
regards
koti
View 1 Replies
View Related
Oct 18, 2007
Hello.
I have a SQL table with one column that has the type = image.
I have a Stored procedure that inserts an image into that table.
CREATE PROCEDURE [dbo].[Test]
@test image
AS
BEGIN
insert into Table_1(test)values(@test)
END
I am using ADO in C++ for creating a connection,command, and parameters.
Code Block
VARIANT par;
par.vt = VT_ARRAY;
par.pbVal = (BYTE*)pBuffer;
pCommand->Parameters->Append(pCommand->CreateParameter("test",DataTypeEnum::adArray, ParameterDirectionEnum::adParamInput,strlen(pBuffer),par));
pCommand->Execute(NULL,NULL,CommandTypeEnum::adCmdStoredProc);
where
Code Block
_CommandPtr pCommand;
pCommand->CommandText = (_bstr_t)procedureName;
pCommand->CommandType = CommandTypeEnum::adCmdStoredProc;
//When I append the created parameter, in comutil.h, at these lines :
namespace _com_util {
inline void CheckError(HRESULT hr) throw(...)
{
if (FAILED(hr)) {
_com_issue_error(hr);
}
}
}
I get an exception : m_hresult 0x80020008 Bad variable type.
If I try to insert a string or an number, it works. But with BYTE* it dosen't.
Can someone help me?
Thanks
View 7 Replies
View Related
Feb 11, 2007
Hi there,
I am creating a report from a stored procedure that returns
multiples record sets. For an example, my stored procedure is as follows
CREATE PROCEDURE MYPROCEDURE
AS
BEGIN
SELECT * FROM TABLE1
SELECT * FROM TABLE2
SELECT * FROM TABLE3
END
Now lets say I want to create a report that will display the
result of the query no 2 (which is SELECT * FROM TABLE2 in this example). How
can I do this? Is there any way to bind the second record set to the report
dataset with out changing the stored procedure?
I will appreciate any kind of suggestions on this
Thanks
Moim
View 8 Replies
View Related
Jul 20, 2005
Hi All,I want to catch the next MSSQL error in my SQL code with following continuecalculationsServer: Msg 17, Level 16, State 1, Line 1SQL Server does not exist or access denied.If REMOTE_SERVER_1 is inaccessible (as in (a) below) the executing of SQLwill not continue with (b) - I need the code in (b) to run despite whetherthe previous exec was successful or not - Any ideas?begin transaction(a) exec REMOTE_SERVER_1...bankinsert '1' , '1' , 1 , 0 , 0(b) print @@errorcommit transactionwhere REMOTE_SERVER_1 is link to server created byEXEC sp_addlinkedserver @server = 'REMOTE_SERVER_1', @srvproduct = '',@provider = 'SQLOLEDB', @datasrc = 'MYCOMP1', @catalog = 'mirror2'EXEC sp_addlinkedsrvlogin @rmtsrvname = 'REMOTE_SERVER_1', .....Exec sp_serveroption 'REMOTE_SERVER_1', 'data access', 'true'Exec sp_serveroption 'REMOTE_SERVER_1', 'rpc', 'true'Exec sp_serveroption 'REMOTE_SERVER_1', 'rpc out', 'true'Exec sp_serveroption 'REMOTE_SERVER_1', 'collation compatible', 'true'Any help will be greatly appreciated
View 1 Replies
View Related