Can I Call Tigger In Store Procdure And Vice Versa??(urgent)
Jun 19, 2006Can i call tigger in store procdure and vice versa??
if yes how it ?????????
Can i call tigger in store procdure and vice versa??
if yes how it ?????????
Can i call Tigger in store procedure or vice versa in sql server 2000.
and How it implement ?
Hi all,
Does anyone know if it is possible to register SQL Server 7.0 in SQL Server 6.5 and vice versa?
I can't find the SQLOLE70.SQL file in SQL Server 7.0 installation disk.
Thanks in advance
Hi guys, how are you? I was wondering how I do to convert int to nvarchar and vice versa?
Thank you very much.
Hey Guys, are you aware of anyone moving from MYSQL to MSSQL or vice versa - what were your experiences - Mark Smith
View 3 Replies View RelatedMy asp.net website is using sqlexpress2005. I am planning to use sql2000 with this existing website. My questions:
1. How can I transfer the database definitions and actual data from 2005 to 2000? is this possible?
2. What if I have exisiting database in sql2000, can I convert it to be used in sql2005?
3. should I manually recreate the database when converting from one version of sqlserver to another? and how abt the actual data?
PLS HELP. big thanks!
I work on the Clinical Surgery Department Data Application.
The patient gets through the Admission, Surgery, PostSurgery and Discharge stages during his staying in the department. The Doctors just insert their medical data in to the different tables. I have three main classes: User, Patient and Portfolio ( patients portfolio ) and all the business bases on these classes.
The problem is with the Classes per Medical Data Tables. The Medical tables should exist cause it includes the medical data about the patient however what is not clear: Whether I should create Business and Entity classes per each medical data table ( and this is something like 50 tables ) or I should insert all the functions in the Portfolio class and then there will be a mess of functions in one class? What is the accepted way to perform it ?
I'm using SQL Server 2005. How can I convert a hex string to a varbinary or the opposite of that?
View 6 Replies View RelatedHi,
We have setup SQL Server 2000 32-bit (Publisher/Subscribers) replication with 5 different locations. We are planning to purchase SQL Server 2005 Enterprise Edition 64-bit and/or 32-bit. I need suggestion, if we have both version of 2005 Enterprise, can we setup replication with SQL Server 2005 64-bit with SQL Server 2005 32-bit? is that supporting?
Also can we run replication with SQL Server 2005 64-bit (Publisher) with SQL Server 2000 32-bit (Subscriber).
- Publisher Subscribers
--------------------------------------------------------------------------------------------------------
1- SQL Server 2005 64-bit SQL Server 2005 32-bit
2- SQL Server 2005 64-bit SQL Server 2000 32-bit
Shamshad Ali
shamshad_ali74@hotmail.com
shamshad_ali74@yahoo.com
I would like to change rows into columns and columns to rows for the query output table
If the query output is shown the table below (including the column names in the first row).
A B C D E
a1 b1 c1 d1 e1
a2 b2 c2 d2 e2
a3 b3 c3 d3 e3
a4 b4 c4 d4 e4
a5 b5 c5 d5 e5
The table needs to be converted to (the rows become columns and columns become rows).
A a1 a2 a3 a4 a5
B b1 b2 b3 b4 b5
C c1 c2 c3 c4 c5
D d1 d2 d3 d4 d5
E e1 e2 e3 e4 e5
Thanks
KK
We were having problems setting up the mirroring, so I did it via command lines. I found out the "alter...set partnership" command works on the mirror server going to the principal, but gets a 1418 error when going from the principal to the mirror.
So if A is the principal and B is the mirror, A to B fails but B to A works.
If I reverse it so that B is the principal and A is the mirror, B to A fails and A to B works.
Any suggestions?
In C#, I can convert UTC time to a specific timezone using:
TimeZoneInfo localTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
DateTime UTCTime = TimeZoneInfo.ConvertTimeToUtc(localTime, localTimeZone);
Is there any equivalent function in T-SQL (SQL Server 2014 / SQL Azure)?
Specifically, I want to be able to convert a time into UTC before inserting it into a table. Right now I am doing:
INSERT INTO Incident (IncidentDescription, dtOccurred)
VALUES (@IncidentDescription, DATEADD(hour, 8, @dtOccurred))
I don't want to hardcode "8" and I want it to adjust for daylight savings time (DST).
Is there any concise solution that does not require me to define SQL functions or have lookup tables? I also don't want to use the difference between GETDATE() and SYSUTCDATETIME(), because the timezone of my server is not my local timezone.
If I join Table1 to Table2 with a WHERE condition, isit the same if I would join Table2 to Table1 consideringthat the size of the tables are different.Let's assume Table2 is much bigger than Table1.I've never used MERGE, HASH JOINs etc, do any ofthese help in this scenario?Thank you
View 3 Replies View Related1. Is it possible and what would be the gotchas for taking a backup of a database in a 32 bit instance of sql server 2000 and loading it into a 64 bit instance of 2000? How about 2005 to 2005?
2. Is it possible to reverse that and go from a 64 bit to a 32 bit?
3. How about going from a 32 bit sql server 2000 into a 64 bit sql server 2005?
We're on the verge of upgrading a rather large database from sqlserver 2000 (32 bit) into 2005 (32 bit) but they anticipate eventually upgrading the hardware to 64 bit at least for production. The test node would remain at 32 bit.
Thanks for any help.
I have a requirement to execute an Oracle procedure from within an SQL Server procedure and vice versa.
How do I do that? Articles, code samples, etc???
I have a stored procedure that creates a normalized table from an existing denorm table. So I just need a simple way to call this SP from an aspx page. It would be good though to know how many records were effected, but this is not a requirement.
View 5 Replies View RelatedI create a store procedure in sql, how do I call it?
thankss
Hi, how to call the shrink_file proc from shrink_file_caller proc as below??
CREATE PROCEDURE [dbo].[Shrink_File]
@DBName VARCHAR(100),
@err INT OUTPUT
AS
...
GO
CREATE PROCEDURE [dbo].[Shrink_File_Caller]
@DBName VARCHAR(100),
@err INT OUTPUT
AS
SET NOCOUNT ON;
DECLARE @nsql NVARCHAR(4000);
SET @nsql = '' + @DBName + '.dbo.Shrink_File ''' + @DBName + ''', @err OUTPUT' ;
EXEC sp_executesql @nsql,N'@err INT OUTPUT', @err = @err OUTPUT;
GO
declare @err int;
EXEC Shrink_File_CALLER 'DATABASE1', @err
select @err as err;
I get the error:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'DATABASE1'.
(1 row(s) affected)
I have searched this forum for how to call a store procedure with
parameter and so far no result has answered my question yet. I have the
following store procedure:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE sqlSearch
-- Add the parameters for the stored procedure here
@strSearch varchar(250)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
WHERE ([name_nws] LIKE '%" + @strSearch + "%' OR
[title_nws] LIKE '%" + @strSearch + "%'OR [sub_nws] LIKE '%" +
@strSearch + "%' OR [sum_nws] LIKE '%" + @strSearch + "%' OR
[content_nws] LIKE '%" + @strSearch + "%')
END
GO
I got this far in my code on how to call the parameter store procedure.
string strConn = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString; SqlConnection sqlConn = new SqlConnection(strConn); SqlCommand sqlComm = new SqlCommand(); sqlComm.Connection = sqlConn; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "sqlSearch"; sqlComm.Parameters.Add("@strSearch", SqlDbType.VarChar); I don't know what do next.
Help is much appreciated.
Hi,is there any method to call a store procedure into a function?ThanksFabio
View 1 Replies View RelatedHow can I get MS ACCES database records from an sql Stored Procedure. Idea is I have a SQL stored procedure, which wants to calculate a few things using some data from an MS access DB. Is it possible or am I talking against any DB principles?
View 1 Replies View RelatedHello, I have one store procedure that writes something data to one physical sql table 'MyTable' and on beginning I first call:DELETE FROM MyTableProcedure returns at the end data from 'MyTable' as on SELECT. PROBLEM:I started SQL Manager on my Laptop and on Computer near me and all pointed to same database (on Server) and I run that procedure simultaneously on Laptop and Computer at the same time (two hands on F5 button on these computers). Occasionally when clicking with both hands at the same time I got no records at the end of execution (on both computers), otherwise I got the results.WHAT I THINK IS PROBLEM:Somhow one SP start working and it did not come to the end and another computer called this SP and execute first command (DELETE FROM MyTable) and I got empty records at the end..WHAT I NEED:I need to prevent this situation to get empty records. All computers must get these records always. How I can use some sort of LOCKs to do this?Or to do that on C# application level using LOCK command? Thanks in advanceAleksandar
View 2 Replies View RelatedGreetings All,
I am coming from a foxpro arena into SQL.
I am currently working on a trigger that
performs a simple copy. Example
copy record to another table if value of field = 1,
then delete orginal record.
CREATE TRIGGER arcit
AFTER UPDATE ON ACTIVE
INSERT
INTO Archive(grid, name)
SELECT *
FROM ACTIVE
WHERE arc = 1
DELETE FROM ACTIVE
WHERE arc = 1
GO
I get the following error
Msg 102, Level 15, State 1, Procedure arcit, Line 2
Incorrect syntax near 'AFTER'.
Also second question with the "INTO Archive(grid, name)"
is their not some global grab all fields I can use here ?
Anyhelp would be great..
when a record is inserted into tNTS, I need the column seq_num updated with the value of the column id (it's the PK)can someone help me with my tigger:CREATE TRIGGER updateNewSeq ON dbo.tNTS FOR INSERTASupdate tNTS (set seq_num =tNTS )SELECT NTS_idFROM INSERTEDcheers
View 5 Replies View Related I know I can call store procedure from store procedure but i want to take the value that the store procedure returned and to use it:
I want to create a table and to insert the result of the store procedure to it.
This is the code: Pay attention to the underlined sentence!
ALTER PROCEDURE [dbo].[test]
AS
BEGIN
SET NOCOUNT ON;
DROP TABLE tbl1
CREATE TABLE tbl1 (first_name int ,last_name nvarchar(10) )
INSERT INTO tbl1 (first_name,last_name)
VALUES (exec total_cash '8/12/2006 12:00:00 AM' '8/12/2006 12:00:00 AM' 'gilad' ,'cohen')
END
PLEASE HELP!!!! and God will repay you in kind!
Thanks!
hello to experts :)
I'm stuck and I'm getting an error message
well the following code show access a store precedure ( on MS SQL 7 ) which the sp it self does work fine (using query analizer )
if I use the following code is asp.net I'll get error
BC30451: Name 'CommandType' is not declared.
on
Line 64: objCmd.CommandType = CommandType.StoredProcedure
please, please have look as it is quite urgent.
many thanks in advance
Meghoo
------------------------------------------------------------------------------------
Function non935(ByVal city As String, ByVal feeEar As String, ByVal year As String) As System.Data.DataSet
Dim connectionString As String = "server='csfirm03'; user id='sa'; password='testfirm'; database='ken_live';pooling=false"
Dim mysqlconn As new System.Data.SqlClient.SqlConnection(connectionString)
Dim myDataReader As System.Data.SqlClient.SqlDataReader
Dim SQL As String = "sp_non935"
Dim objCmd As New System.Data.SqlClient.SqlCommand(SQL, mySqlConn)
objCmd.CommandType = CommandType.StoredProcedure
Dim objParam As System.Data.SqlClient.SqlParameter
objParam = objCmd.Parameters.Add("@city", SqlDbType.VarChar)
objParam.Value = @city
objParam = objCmd.Parameters.Add("@trec", SqlDbType.Int)
objParam.Value = @feeEar
objParam = objCmd.Parameters.Add("@year", SqlDbType.VarChar)
objParam.Value = @year
mySqlConn.Open()
myDataReader = objCmd.ExecuteReader(CommandBehavior.CloseConnection)
'Do stuff with the data reader
myDataReader.Close()
mySqlConn.Close()
myDataReader = Nothing
mySqlConn = Nothing
Return dataSet
End Function
Sub year_SelectedIndexChanged(sender As Object, e As EventArgs)
datagrid2.datasource=non935(city.SelectedItem.Value,trec.text,year.SelectedItem.Value)
datagrid2.databind()
End Sub
How can I use a store procedure in a asp.net. I have been trying many ways but it shows an error : "Invalid attempt to read when no data is present." when I am trying to read the data reader
My store procedure just return one value.
StoreProcedure:
create procedure sp_recordstudent
@studentid integer
as
if exists (select * from tbl_student where int_studentid = @studentid)
select strregistro = 'true'
else
select strregistro = 'false'
go
ASP.net
Dim Conn As New SqlConnection("server='(local)';database='BSF';trusted_connection=true")
Conn.open()
Dim Comm as SqlCommand = Conn.createcommand()
Comm.connection = conn
Dim Trans as SQLTransaction
Dim Query as String = ""
Dim DRStudent as SQLDataReader
'Verify whether the student exists
Query = "execute sp_recordstudent @studentid = " & intSId
Comm = New SQLCommand(query,conn)
'Comm.commandtext =
DRStudent = comm.executereader()
blstudentexist = DRStudent.getstring(o)
DRStudent.close()
Basically i make use of FormView in Web Developer Express Edition to create and store information to the database .... what i want to do further is to capture the value within the primary key of the newly created recordset that I set it become auto increament .....this value would be stored within a session string in global condition that allowed any page able to access it .....
View 3 Replies View Related i am working on a uni project based on orkut and is having dfficulty in storing and retrieving images..
can anybody please guide me...
thanx
Hi group,
I don't know what I should try next, all of my tries have been without results in this case. I just wanted to create a temporary table, then insert one row into it and then use this row to compare if this row exists in another table or not. This is my script:
------------------------
CREATE PROCEDURE imp_Tippimport (@TGName char(33)) AS
BEGIN
CREATE TABLE #tTippgeber (
TGName2 char(33)
)
INSERT INTO #tTippgeber (TGName2)
VALUES (@TGName)
*** see below ***
IF NOT exists (select TGName FROM Tippgeber WHERE TGName = @TGName)
INSERT INTO Tippgeber SELECT TGName2 FROM #tTippgeber
/* SELECT * INTO Tippgeber FROM #tTippgeber */
ELSE
UPDATE Tippgeber SET
TGName = t.TGName2
FROM #tTippgeber AS t, Tippgeber
WHERE TGName = t.TGName2
END
GO
I also created a cursor and used a fetch in to a veriable in the line with the stars to see the value of TGName2 but it was NULL.
Any ideas ?!
Thanks for any help !!
Sascha
Inside some TSQL programmable object (a SP/or a query in Management Studio)I have a parameter containing the name of a StoreProcedure+The required Argument for these SP. (for example it's between the brackets [])
EX1 : @SPToCall : [sp_ChooseTypeOfResult 'Water type']
EX2 : @SPToCall : [sp_ChooseTypeOfXMLResult 'TABLE type', 'NODE XML']
EX3 : @SPToCall : [sp_GetSomeResult]
I can't change thoses SP, (and i don't have a nice output param to cach, as i would need to change the SP Definition)All these SP 'return' a 'select' of 1 record the same datatype ie: NVARCHAR. Unfortunately there is no output param (it would have been so easy otherwise. So I am working on something like this but I 'can't find anything working
DECLARE @myFinalVarFilledWithCachedOutput
NVARCHAR(MAX);
DECLARE @SPToCall NVARCHAR(MAX) = N'sp_ChooseTypeOfXMLResult
''TABLE type'', ''NODE XML'';'
DECLARE @paramsDefintion = N'@CatchedOutput NVARCHAR(MAX) OUTPUT'
[code]...
Whenever I run this DTS package that has a SQLTask, I get the following error message: "Maximum stored procedure nesting level exceeded(Limit 32)"
What does this mean? My query was working fine, but now I'm recieving this error message. I won't complet my required task. Is there any way to change the nesting level to be unlimited. I am totally confused. If you can please help. Thanks again.
Dre
Hi,
I want to create a text file and write to text it by calling its assembly from Stored Procedure. Full Detail is given below
I write a code in class to create a text file and write text in it.
1) I creat a class in Visual Basic.Net 2005, whose code is given below:
Imports System
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Public Class WLog
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
End Sub
Public Shared Sub LogIt(ByVal logMessage As String, ByVal wr As StreamWriter)
wr.Write(ControlChars.CrLf & "Log Entry:")
wr.WriteLine("(0) {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString())
wr.WriteLine(" :")
wr.WriteLine(" :{0}", logMessage)
wr.WriteLine("---------------------------")
wr.Flush()
End Sub
Public Shared Sub LotToEventLog(ByVal errorMessage As String)
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessage)
End Sub
End Class
2) Make & register its assembly, in SQL Server 2005.
3)Create Stored Procedure as given below:
CREATE PROCEDURE dbo.SP_LogTextFile
(
@LogName nvarchar(255), @NewMessage nvarchar(255)
)
AS EXTERNAL NAME
[asmLog].[WriteLog.WLog].[LogToTextFile]
4) When i execute this stored procedure as
Execute SP_LogTextFile 'C:Test.txt','Message1'
5) Then i got the following error
Msg 6522, Level 16, State 1, Procedure SP_LogTextFile, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'SP_LogTextFile':
System.UnauthorizedAccessException: Access to the path 'C:Test.txt' is denied.
System.UnauthorizedAccessException:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, ileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.AppendText(String path)
at WriteLog.WLog.LogToTextFile(String LogName, String newMessage)