I am trying to call a view that is already in SQL Server 2005 from my ASP.NET 2.0 application. I get the following error message: The request for procedure 'vwMyView failed because 'vwMyView' is a view object. I thought I could call a view the same way that I call a stored procedure but I guess I was wrong. How can I fix this? Here is some sample code too: Dim Results As DataSetDim Cmd As IDbCommand Dim Adapter As IDbDataAdapter Results = New DataSet Cmd = DB.CreateCommandCmd.CommandText = "vwMyView" Cmd.CommandType = CommandType.StoredProcedure Adapter = DataSource.CreateDataAdapter Adapter.SelectCommand = Cmd DB.Open() Cmd.Connection = DB Adapter.Fill(Results) Cmd.Dispose() DB.Close() Return Results
I am producing a php report using SQL queries to show the SLA status of our calls. Each call has response, fix & completion targets. If any of these targets are breached, the whole SLA status is set as 'Breach'.
The results table should look like the one below:
CallRef.
Description
Severity
ProblemRef
Logged Date
Call Status
SLA Status
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
Breach
C0002
PO€™s not published
2
DGE0014
06-01-06 10:21
Resolved
OK
C0003
Approval for PO€™s not received from Siebel.
2
n/a
05-01-06 14:48
Investigating
OK
Whereas I can pick the results for the first 6 columns from my Select query, the 'SLA Status' column requires the following calculation:
The problem is that my query is returning multiple entries for each stage of the call (see below), whereas I just want one entry for each call, with SLA status 'Breach' if any of the stages for the call were out of SLA.
CallRef.
Description
Severity
ProblemRef
Logged Date
Call Status
SLA Status
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
Breach
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
OK
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
Breach
Any help will be much much appreciated, this issue has been bothering me for some time now!!!
have SQL Server 2005 std edition SP1 installed on Windows 2003 Std edition .Configured Transactional (single Publisher and no clustered environment.) Replication past two months working fine, Now 1.Distrib.exe application err is coming.
Due to which my job is failing (Distributor to Subscriber). Iam attaching thw file. Thanks Sandeep
Hey, don't know if it's the right place for this question but i hope you help me. I made an application with VS 2005 that connecting to sql server file db.mdf Now i want this application work on another user computer, and of course i don't want to install vs 2005 there. I did install .net framework, but what i need to do to make the database work? do i have to install sql server on his computer? or is there something more simple? I know that if i was using access file than i need to install nothing else. please help! thanx. max
I've written a T-SQL stored procedure that I want to call other stored procedures. The opening part of it looks like this:set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[spArchive] @dtArchiveBefore DateTimeASEXEC spArchiveAHD @dtArchiveBeforeGOEXEC spArchiveContract_History @dtArchiveBeforeGOEXEC spArchiveContracts @dtArchiveBeforeGO But I'm getting this error repeatedly: Msg 137, Level 15, State 2, Line 2 Must declare the scalar variable "@dtArchiveBefore".I've searched for this term but can't figure out what's wrong with my code.Any ideas?Robert W.
Do you know when should I use extend sp to call a dll file, and when should I use sp_OACreate to call dll. It seems only dll created by C++ can be called from extend sp, how about VB created dll?
MS SQL 2005 I developed several SP that update tables If I execute them one by one in the SQL Sever Management Studio, they work ok
Now, I want to execute them all inside another SP I wrote it (attached code) Execute it and give me a message that runs successfully but that is not true May anyone of You tell me the right syntax to do it?
[Code] USE REPORTES GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATEPROCEDURE dbo.Astral_sp_Acumula AS -- EXECUTE [REPORTES].[dbo].[Astral_sp_AcCpasArtC] GO EXECUTE [REPORTES].[dbo].[Astral_sp_AcDevArtC] GO EXECUTE [REPORTES].[dbo].[Astral_sp_AcVtasArtV] GO -- More sp executions [Code]
Hi all, I have 2 tables like that CREATE TABLE tab1 ( id int IDENTITY (1, 1) NOT NULL , master varchar (50) NULL ) ON PRIMARY GO
CREATE TABLE tab2 ( id int IDENTITY (1, 1) NOT NULL , student_name varchar (50) NULL , master_id int NULL )
Now i want to create a Sp which is
create proc inner_sp(@s1 varchar(50)) as insert into tab1(master) values (@s1)
and i want to call it from another sp
create proc outer_sp2(@s2 varchar(50),@s1 varchar(50)) as declare @r int exec inner_sp @s1 set @r=Scope_Identity() insert into tab2(student_name,master_id) values(@s2,@r)
exec outer_sp2 'Vivek1','Test'
But in table tab2 master_id column contain NULL value.... Please fix it... Ujjwal
I have two databases with two identical tables in seperate physical locations. I want database B tables to be updated automatically when database A tables change. Is there a way to call a web service from SQL to make this happen? Or is there a better way to do this? I would really like it to get the rows that were modified and then copy only those rows to the other database tables. If anyone knows if this can be done please let me know. Thank you.
Well I seem to be a gomer when trying to understand XML. Could some one please help me? I am trying to write a script or DTS package that will read 4 XML files (Do not call list) compare each phone number to the numbers I have in my DB and if there is a match put the contactID in to another table. Or at the very least get the XML phone numbers into the database. This is what the XML doc looks like
can someone point me in the right direction? I know how to call a stored procedure, but I can't seem to find code examples on how to call user defined functions.
Is it possible for me to call a DTS package from within a stored procedure? If it is not possible to do so directly, would I at least be able to call the package through a job?
Hi, I need to call a stored procdure from a SQL statement that I am running from query analyzer.
My SQL statement will select from a master table of bills. I have a stored procedure that calculates the amount due on each bill. The sp does not use the master table in the calculation.
How do I form the SQL statement to call the sp, which needs one of the master table columns as a parm? i.e. SELECT *, EXEC sp_abc columns name AS whatever FROM tblMaster WHERE...... TIA! Dave
Hi, sorry I am kind of stuck how to do this correctly. The following is my problem statement:
There are three tables: TAB1 TAB2 TAB3
There is a 1 to many relationship between TAB2 and TAB1.
For every row in TAB2 that has a match in TAB1, they are related via TAB2.col3 = TAB1.col2
I want to delete all those rows in both tables that match, but I have to delete those rows in TAB1 first because of dependency constraints. The primary key for TAB2.col1
Therefore I need to have a select block first and store it somewhere(?)
select TAB2.col1 from TAB2 where TAB2.col3 IN (select TAB1.col2 from TAB1 where TAB1.col1 IN (select TAB3.col1 from TAB3))
Then I delete all those rows in TAB1 that has a match in TAB3
delete from TAB1 where TAB1.col1 IN (select TAB3.col1 from TAB3))
now i delete those rows in TAB2 from the result set of the first sql block.
/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 4/30/2008 2:25:41 PM ******/ if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ostat_CDS_rpt47_2006]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[ostat_CDS_rpt47_2006] GO
set @tb1= 'margin..ncds0421' set @tb2='Report.dbo.ob_apr08'
set @sql= ' insert into '+@tb2+' select yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,0 isCallback, cast(callcost as decimal (10,5)) cost,count(*) attempt, sum(case when connectflg=1 then 1 else 0 end) connected,sum(talktime) Talktime from '+@tb1+' where yyyy='+ltrim(str(@pYear))+' and mm='+ltrim(Str(@pMonth)) +' and dd between '+ltrim(Str(@pDay1))+' and '+ltrim(Str(@pDay2))+' and talktime >0 and trunkin is null group by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5)) order by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5)) ' --print (@sql) exec (@sql)
Question: what do we call the table that does the n to n Relation
Hi, When we have Table1 and Table2, then we link both tables using a third table Table3 that relates n records in Table1 to n records in table2, how do we call Table3? There is a name in dataBase modeling for that, right?
But when I create a SQL XML Webservice via an endpoint all I can find on the net is how to show the wsdl.
http://localhost/Contacts?wsdl
Ive created a method in the "Contacts" webservice called GetContacts. Why cant I construct a similar url to execute that method without having to write a vb.net wrapper for it?
Does anybody know if it's possible to call an object (specifically, a textbox) from the expression of another object? I would imagine it would something like 'objectname.Value' or 'objectname.ToString', but I can't get it to recognise my object names.
I have two textboxes - Last Event and Number of Weeks Since Last Event. I have an expression to calculate the date of the last event (which is rather lengthy), and currently I get the number of weeks by doing a DateDiff between Today and another copy of the lengthy LastEvent code. This works, but it would be much simpler and more efficient if I could just say:
I would like to use SP as Subquery in my query. SP returns decimal value..
Is it possible, if not do you have an idea ?
Code Blockselect id, (exec css_satis_puan2 @ay1='10.2007',@ay2='11.2007',@ay3='12.2007',@tip2=1,@servis=ss.id) as result1, (exec css_satis_puan2 @ay1='10.2007',@ay2='11.2007',@ay3='12.2007',@tip2=2,@servis=ss.id) as result2 from users as ss where uid between 1 and 200
We have an application that use SQL server 2005 . The databses on the server are mirrored. Also we have witness. During a test we failovered from principal to mirrored server. Our application gets error message during 5 minutes. The errors were that sql connection has timeout. Also on mirrored server in event viewer I found next errors:
An SNI call failed during a Service Broker/Database Mirroring transport operation. SNI error '10065(error not found)'. You can find this error in sys.message, where message_id=8471
An error occurred in a Service Broker/Database Mirroring transport connection endpoint, Error: 8471, State: 2. (Near endpoint role: Initiator, far endpoint address: '10.10.23.8') The mirroring connection to "TCP://primary_srv:5022" has timed out for database "Application_database" after 10 seconds without a response. Check the service and network connections. Database mirroring connection error 2 'Connection attempt failed with error: '10060(error not found)'.' for 'TCP://primary_srv:5022'. Database mirroring connection error 4 '64(error not found)' for 'TCP://primary_srv.posprod.supersol.co.il:5022'. last 2 errors can be found in sys.message, where message_id=1474Our computers is windows 2003, SQL2005 sp2 with fotfix of audust. Also few ours before this test .Net3 was installed on those computers.
Any advises? Some help & ideas. What does this errors means?
I am trying to create a stored procedure to Call ALTER LOGIN based on the the username passed in. However, the Alter login statement chokes on any parameter. Is there a way I can alter sql logins from a web form ? I try the following and it bombs
ALTER LOGIN @LoginName WITH PASSWORD = @Password But this works ALTER LOGIN 'TestUser' WITH PASSWORD = '123test' I guess the alter login statement does not work with Parameters. Any thoughts ?
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.
I have a stored procedure I created in SQL server 2005. Now I need to call the stored procedure in C#. Can someone help me out here? What is the C# code I need to call this stored procedure? I have never done this before and need some help. CREATE PROCEDURE [dbo].[MarketCreate] ( @MarketCode nvarchar(20), @MarketName nvarchar(100), @LastUpdateDate nvarchar(2),) ASINSERT INTO Market( MarketCode MarketName LastUpdateDate)VALUES( @MarketCode @MarketName @LastUpdateDate )