Stored Procedure Troubles -- Please Help!

Dec 9, 2004

I have a sproc that does an insert/update into tables HS_Entity and HS_Content. When I run it from Sql Query Analyzer, it executes no problemo. When I call it from my asp.net app, using the exact same (hard-coded) parameters, I get this error:





"Object must implement IConvertible."





I understand this is normally a conversion issue, but I've checked each value a million times!








========================================================





-- ENTITY TABLE


@name nvarchar (50),


@keywords nvarchar(500),


@permissions nvarchar (12),


@isActive bit,


@createdBy nvarchar(50),


@updatedBy nvarchar(50),





-- CONTENT TABLE


@contentPk int,


@categoryPk int,


@contentTitle nvarchar(500),


@content nvarchar(2500)





as





declare @entityPk int


declare @version int


declare @updated smalldatetime


declare @created smalldatetime


set @updated = getDate()


set @created = getDate()





if @contentPk > 0


-- UPDATE ENTITY AND CONTENT: INSERTS NEW ENTITY AND CONTENT AND INCREMENTS VERSION


begin


set @entityPk = (select entityPk from HS_Content where contentPk=@contentPk)


set @version = (select version from HS_Entity where entityPk=@entityPk)-- + 1


exec HS_Entity_IU


10, --1


@version,


@name,


@keywords,


@permissions,


@isActive,


@created,


@updated





update HS_Content set


entityPk=@entityPk,


categoryPk=@categoryPk,


contentTitle=@contentTitle,


content=@content


where contentPk=@contentPk


end


else


-- INSERT ENTITY AND CONTENT: INSERTS NEW ENTITY AND CONTENT


begin


set @version = 1


exec HS_Entity_IU


10,


@version,


@name,


@keywords,


@permissions,


@isActive,


@created,


@updated


set @entityPk = (select top 1 entityPk from HS_Entity order by entityPk asc)





insert into HS_Content values


(@entityPk, @categoryPk, @contentTitle, @content)


end





==============================================











Here is a portion of the c# code:





==============================================





paramCol[i] = new SqlParameter("@name", SqlDbType.NVarChar, 50);


paramCol[i].Direction = ParameterDirection.Input;


paramCol[i++].Value = name;


paramCol[i] = new SqlParameter("@keywords", SqlDbType.NVarChar, 500);


paramCol[i].Direction = ParameterDirection.Input;


paramCol[i++].Value = keywords;


paramCol[i] = new SqlParameter("@permissions", SqlDbType.NVarChar, 12);


paramCol[i].Direction = ParameterDirection.Input;


paramCol[i++].Value = permissions.ToString();


paramCol[i] = new SqlParameter("@isActive", SqlDbType.Bit, 1);


... etc





try {


SqlHelper.ExecuteNonQuery(Global.ConnectionString, "HS_Content_IU", paramCol);


} catch (Exception ex) {


if (conn.State == ConnectionState.Open)


conn.Close();


conn.Dispose();


System.Web.HttpContext.Current.Response.Write(ex.Message);


}





==============================================





thanks for your help!


Brent

View 2 Replies


ADVERTISEMENT

Stored Proc Troubles

Nov 11, 2006

I'm confused. I am trying to return the results of a stored proc to a web service I have created using Visual Web Developer Express. The stored proc works correctly and can execute it from SQL Server. The last line of the stored proc is a simple select. If I comment out everything in the stored proc except the final SELECT statement, I can successfully return the data.using the "INVOKE" during my debug from my service page. I can enter the parameters and it works fine. BUT when I try to call the full stored proc from my service, I don't get anything.  I am confused - is there something different you have to do when using stored procs? It appears to execute from my code, as I can see the data in the table change when I call the proc. But I can't seem to return the results unless I comment out everything in the stored proc except the SELECT....anyone else run across this?  What am I missing? Code snippet is below...thanks in advance. headjoog  <WebMethod()> _
Public Function ReturnData(ByVal SomeKey As Int16, ByVal StartDate As Date, ByVal EndDate As Date, _
ByVal aName As String, ByVal SomeNum As Int16, ByVal AnotherNum As Int16) As MyData.MyData_DataTable
Dim theSet As New MyData()
Dim theAdapter As New MyData_TableAdapters.MyDataTableAdapter()
Return theAdapter.GetDayPatterns(SomeKey, StartDate, EndDate, aName, SomeNum, AnotherNum)
End Function
 

View 1 Replies View Related

Calling A Stored Procedure Inside Another Stored Procedure (or Nested Stored Procedures)

Nov 1, 2007

Hi all - I'm trying to optimized my stored procedures to be a bit easier to maintain, and am sure this is possible, not am very unclear on the syntax to doing this correctly.  For example, I have a simple stored procedure that takes a string as a parameter, and returns its resolved index that corresponds to a record in my database. ie
exec dbo.DeriveStatusID 'Created'
returns an int value as 1
(performed by "SELECT statusID FROM statusList WHERE statusName= 'Created') 
but I also have a second stored procedure that needs to make reference to this procedure first, in order to resolve an id - ie:
exec dbo.AddProduct_Insert 'widget1'
which currently performs:SET @statusID = (SELECT statusID FROM statusList WHERE statusName='Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
I want to simply the insert to perform (in one sproc):
SET @statusID = EXEC deriveStatusID ('Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
This works fine if I call this stored procedure in code first, then pass it to the second stored procedure, but NOT if it is reference in the second stored procedure directly (I end up with an empty value for @statusID in this example).
My actual "Insert" stored procedures are far more complicated, but I am working towards lightening the business logic in my application ( it shouldn't have to pre-vet the data prior to executing a valid insert). 
Hopefully this makes some sense - it doesn't seem right to me that this is impossible, and am fairly sure I'm just missing some simple syntax - can anyone assist?
 

View 1 Replies View Related

Calling A Stored Procedure From ADO.NET 2.0-VB 2005 Express: Working With SELECT Statements In The Stored Procedure-4 Errors?

Mar 3, 2008

Hi all,

I have 2 sets of sql code in my SQL Server Management Stidio Express (SSMSE):

(1) /////--spTopSixAnalytes.sql--///

USE ssmsExpressDB

GO

CREATE Procedure [dbo].[spTopSixAnalytes]

AS

SET ROWCOUNT 6

SELECT Labtests.Result AS TopSixAnalytes, LabTests.Unit, LabTests.AnalyteName

FROM LabTests

ORDER BY LabTests.Result DESC

GO


(2) /////--spTopSixAnalytesEXEC.sql--//////////////


USE ssmsExpressDB

GO
EXEC spTopSixAnalytes
GO

I executed them and got the following results in SSMSE:
TopSixAnalytes Unit AnalyteName
1 222.10 ug/Kg Acetone
2 220.30 ug/Kg Acetone
3 211.90 ug/Kg Acetone
4 140.30 ug/L Acetone
5 120.70 ug/L Acetone
6 90.70 ug/L Acetone
/////////////////////////////////////////////////////////////////////////////////////////////
Now, I try to use this Stored Procedure in my ADO.NET-VB 2005 Express programming:
//////////////////--spTopSixAnalytes.vb--///////////

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim sqlConnection As SqlConnection = New SqlConnection("Data Source = .SQLEXPRESS; Integrated Security = SSPI; Initial Catalog = ssmsExpressDB;")

Dim sqlDataAdapter As SqlDataAdapter = New SqlDataAdaptor("[spTopSixAnalytes]", sqlConnection)

sqlDataAdapter.SelectCommand.Command.Type = CommandType.StoredProcedure

'Pass the name of the DataSet through the overloaded contructor

'of the DataSet class.

Dim dataSet As DataSet ("ssmsExpressDB")

sqlConnection.Open()

sqlDataAdapter.Fill(DataSet)

sqlConnection.Close()

End Sub

End Class
///////////////////////////////////////////////////////////////////////////////////////////

I executed the above code and I got the following 4 errors:
Error #1: Type 'SqlConnection' is not defined (in Form1.vb)
Error #2: Type 'SqlDataAdapter' is not defined (in Form1.vb)
Error #3: Array bounds cannot appear in type specifiers (in Form1.vb)
Error #4: 'DataSet' is not a type and cannot be used as an expression (in Form1)

Please help and advise.

Thanks in advance,
Scott Chang

More Information for you to know:
I have the "ssmsExpressDB" database in the Database Expolorer of VB 2005 Express. But I do not know how to get the SqlConnection and the SqlDataAdapter into the Form1. I do not know how to get the Fill Method implemented properly.
I try to learn "Working with SELECT Statement in a Stored Procedure" for printing the 6 rows that are selected - they are not parameterized.




View 11 Replies View Related

T-SQL (SS2K8) :: One Stored Procedure Return Data (select Statement) Into Another Stored Procedure

Nov 14, 2014

I am new to work on Sql server,

I have One Stored procedure Sp_Process1, it's returns no of columns dynamically.

Now the Question is i wanted to get the "Sp_Process1" procedure return data into Temporary table in another procedure or some thing.

View 1 Replies View Related

SQL Server 2014 :: Embed Parameter In Name Of Stored Procedure Called From Within Another Stored Procedure?

Jan 29, 2015

I have some code that I need to run every quarter. I have many that are similar to this one so I wanted to input two parameters rather than searching and replacing the values. I have another stored procedure that's executed from this one that I will also parameter-ize. The problem I'm having is in embedding a parameter in the name of the called procedure (exec statement at the end of the code). I tried it as I'm showing and it errored. I tried googling but I couldn't find anything related to this. Maybe I just don't have the right keywords. what is the syntax?

CREATE PROCEDURE [dbo].[runDMQ3_2014LDLComplete]
@QQ_YYYY char(7),
@YYYYQQ char(8)
AS
begin
SET NOCOUNT ON;
select [provider group],provider, NPI, [01-Total Patients with DM], [02-Total DM Patients with LDL],

[Code] ....

View 9 Replies View Related

Connect To Oracle Stored Procedure From SQL Server Stored Procedure...and Vice Versa.

Sep 19, 2006

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???

View 1 Replies View Related

Grab IDENTITY From Called Stored Procedure For Use In Second Stored Procedure In ASP.NET Page

Dec 28, 2005

I have a sub that passes values from my form to my stored procedure.  The stored procedure passes back an @@IDENTITY but I'm not sure how to grab that in my asp page and then pass that to my next called procedure from my aspx page.  Here's where I'm stuck:    Public Sub InsertOrder()        Conn.Open()        cmd = New SqlCommand("Add_NewOrder", Conn)        cmd.CommandType = CommandType.StoredProcedure        ' pass customer info to stored proc        cmd.Parameters.Add("@FirstName", txtFName.Text)        cmd.Parameters.Add("@LastName", txtLName.Text)        cmd.Parameters.Add("@AddressLine1", txtStreet.Text)        cmd.Parameters.Add("@CityID", dropdown_city.SelectedValue)        cmd.Parameters.Add("@Zip", intZip.Text)        cmd.Parameters.Add("@EmailPrefix", txtEmailPre.Text)        cmd.Parameters.Add("@EmailSuffix", txtEmailSuf.Text)        cmd.Parameters.Add("@PhoneAreaCode", txtPhoneArea.Text)        cmd.Parameters.Add("@PhonePrefix", txtPhonePre.Text)        cmd.Parameters.Add("@PhoneSuffix", txtPhoneSuf.Text)        ' pass order info to stored proc        cmd.Parameters.Add("@NumberOfPeopleID", dropdown_people.SelectedValue)        cmd.Parameters.Add("@BeanOptionID", dropdown_beans.SelectedValue)        cmd.Parameters.Add("@TortillaOptionID", dropdown_tortilla.SelectedValue)        'Session.Add("FirstName", txtFName.Text)        cmd.ExecuteNonQuery()        cmd = New SqlCommand("Add_EntreeItems", Conn)        cmd.CommandType = CommandType.StoredProcedure        cmd.Parameters.Add("@CateringOrderID", get identity from previous stored proc)   <-------------------------        Dim li As ListItem        Dim p As SqlParameter = cmd.Parameters.Add("@EntreeID", Data.SqlDbType.VarChar)        For Each li In chbxl_entrees.Items            If li.Selected Then                p.Value = li.Value                cmd.ExecuteNonQuery()            End If        Next        Conn.Close()I want to somehow grab the @CateringOrderID that was created as an end product of my first called stored procedure (Add_NewOrder)  and pass that to my second stored procedure (Add_EntreeItems)

View 9 Replies View Related

SQL Server 2012 :: Executing Dynamic Stored Procedure From A Stored Procedure?

Sep 26, 2014

I have a stored procedure and in that I will be calling a stored procedure. Now, based on the parameter value I will get stored procedure name to be executed. how to execute dynamic sp in a stored rocedure

at present it is like EXECUTE usp_print_list_full @ID, @TNumber, @ErrMsg OUTPUT

I want to do like EXECUTE @SpName @ID, @TNumber, @ErrMsg OUTPUT

View 3 Replies View Related

System Stored Procedure Call From Within My Database Stored Procedure

Mar 28, 2007

I have a stored procedure that calls a msdb stored procedure internally. I granted the login execute rights on the outer sproc but it still vomits when it tries to execute the inner. Says I don't have the privileges, which makes sense.

How can I grant permissions to a login to execute msdb.dbo.sp_update_schedule()? Or is there a way I can impersonate the sysadmin user for the call by using Execute As sysadmin some how?

Thanks in advance

View 9 Replies View Related

Ad Hoc Query Vs Stored Procedure Performance Vs DTS Execution Of Stored Procedure

Jan 23, 2008



Has anyone encountered cases in which a proc executed by DTS has the following behavior:
1) underperforms the same proc when executed in DTS as opposed to SQL Server Managemet Studio
2) underperforms an ad-hoc version of the same query (UPDATE) executed in SQL Server Managemet Studio

What could explain this?

Obviously,

All three scenarios are executed against the same database and hit the exact same tables and indices.

Query plans show that one step, a Clustered Index Seek, consumes most of the resources (57%) and for that the estimated rows = 1 and actual rows is 10 of 1000's time higher. (~ 23000).

The DTS execution effectively never finishes even after many hours (10+)
The Stored procedure execution will finish in 6 minutes (executed after the update ad-hoc query)
The Update ad-hoc query will finish in 2 minutes

View 1 Replies View Related

BCP Troubles

Aug 9, 2005

We are trying to move data from a product called TABLEBase that runs onthe mainframe and we are experiencing problems trying to BCP the datainto SQL Server. The SQL server we are tying to BCP into is SQL 2000.We are using BCP from a command prompt.Here is what happens.the first time it doesn't load anything and we get no messages.The onlyway I got it to work was to run BCP and have it create a ForMaT file.I compared the ForMat file I created by hand,to the ForMat file Icreated from BCP they are identical. (I used a product called beyondcompare to check it). After I created the ForMaT file and loaded thedata, I then deleted the data and ran it with the original ForMaT file(no changes) and the data loaded fine this time.Has anyone else run into this before? It is driving us nuts!

View 6 Replies View Related

SSL Troubles

May 16, 2007

I finally got an SSL cert to show up!!!



But when I try to connect, I get this pesky error message:





provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.





Does anyone know how I turn on ' trusting myself ' or get this to go away?



View 3 Replies View Related

User 'Unknown User' Could Not Execute Stored Procedure - Debugging Stored Procedure Using Visual Studio .net

Sep 13, 2007

Hi all,



I am trying to debug stored procedure using visual studio. I right click on connection and checked 'Allow SQL/CLR debugging' .. the store procedure is not local and is on sql server.



Whenever I tried to right click stored procedure and select step into store procedure> i get following error



"User 'Unknown user' could not execute stored procedure 'master.dbo.sp_enable_sql_debug' on SQL server XXXXX. Click Help for more information"



I am not sure what needs to be done on sql server side



We tried to search for sp_enable_sql_debug but I could not find this stored procedure under master.

Some web page I came accross says that "I must have an administratorial rights to debug" but I am not sure what does that mean?



Please advise..

Thank You

View 3 Replies View Related

SQL Query Troubles

Jun 11, 2007

Hi I'm currently having some troubles formulating an SQL query.  The idea is this (in psuedo code): Select * From datatableIf (@input1 = "Hello") Then ( WHERE @input1 = column1 AND column4 = 1 )ELSE ( WHERE @input1 = column1 AND @input2 = column2 AND @input3 = column3 ) Basicly I need it to perform the first filter if input1 is very specific or otherwise perform the the second filter Thanks 

View 5 Replies View Related

GUID Troubles.

Apr 17, 2004

Hi,

I am having a hard time updating a database row using a UNIQUEIDENTIFIER. I retrieve the row into a datagrid and then use the GUID as a parameter to a stored procedure, but it doesn't update. If I run the query in SQL Analyser ... it works. Any ideas ? Here's my stored proc ... I tried passing a varchar and doing the conversion in the SP ... no go !! I am using MApplicationBlockD.


CREATE PROCEDURE spScanUpdate
@id varchar (100),
@name varchar (75)
AS
DECLARE @GUID_ID as uniqueidentifier
SELECT@GUID_ID = CAST ( @id as uniqueidentifier )

UPDATE tScan
SET name = @name
WHEREid = @GUID_ID
GO

View 5 Replies View Related

Troubles With Code...

Jun 9, 2004

Hi there,

I am trying to code a button that queries a database, and as a result of the query will re-direct a user to a different page. I have put together the following code, but know it is so wrong. Any suggestions on how to develop this would be greatly appreciated! I need it to be done through a button rather than a session etc.


Sub button_Click (ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim myData AS SqlConnection
Dim cmdSelect as SqlCommand

myData = New SqlConnection(ConnectionString)

myData.open()

cmdSelect = new SqlCommand("SELECT payDate FROM tblPayments WHERE userName = Matt", myData)

IF cmdSelect >= Date.Now() Then
Response.Redirect("youraccount.aspx")
Else
Response.Redirect("payment.aspx")
End If

myData.close()

End Sub


Thanks in advance for your help,

TCM

View 6 Replies View Related

Troubles With A Sql Query

Dec 22, 2004

Hi guys I am having troubles writting a SQL query. Here is the situation I have two phrases and I have to do a search on first three letters of each word in the first phrase and see if it matches any word in the second phrase.
For example

Phrase 1: "The Company Corporation"
Phrase 2: "Correy and sons"

This should be a match since "Cor" from Corporation matches with "Cor" from Correy.

Any help....

View 5 Replies View Related

DTS Jobs Troubles

Mar 1, 2004

I'm trying to run DTS packages (import AS400 information) on a job and it fails, but when I program a DTS package job that imports from SQL Server to SQL Server it does not fail.

What can I do?

I hope your answer

Thanks

Cristopher Serrato

View 5 Replies View Related

ISNull Troubles

Jun 17, 2008

I'm having a problem creating a isnull statement.
I want to do two things I want to list all of the accounts that have a null value in a numeric field. And I want to update those accounts to 0.00.
I tried:
select Account_Num, isnull(TotalDDMFEE, 0)
FROM Addr_20080402
But it returned all records

For the update I tried:
update Addr_20080402
CASE
when TotalDDMFEE = ' ' then TotalDDMFEE = 0.00
AND
update Addr_20080402
CASE
when TotalDDMFEE = isnull(TotalDDMFEE, 0) then TotalDDMFEE = 0.00

Any ideas how I should have written these two queries?
Thanx,
Trudye

View 3 Replies View Related

Backup Troubles

Apr 18, 2007

Hi all,

the system I am working on was upgraded recently from SQL2000 to SQL2005, and it's generating strange issues after then.

The maintenace plan stopped working (the job was going to run forever if I didn't stop them), and I was able after some tests to understand the cause: It's impossible to backup two of the databases I have on the server.

If I try to di it manually I got this:
ERROR 3026
"Backup and file manipulation operations (such as ALTER DATABASE ADD FILE) on a database must be serialized (...)"

You could think it's because someone is using the DBs at the same time, but I tried to Execute the Plan at night and the morning before it was still there running since 12 hours. If I cut from the maintenance plan these two databases the job runs just fine.

A strange thing, maybe a relevant clue, is that when I go to the tasks-->Backup and the SQL Server suggests a name for the new bak file instead of having a .BAK file (as for the others DBs I have there - something like 10) It tries to put the backup in a .TRN file (the sequence number seems to be correct - I have myDB_backup_200704181200.TRN instead of myDB_backup_200704181200.BAK); what makes me think this is a clue is that all this happens only for these two databases I cannot backup.

Ring any bells?

Thanks in advance,

Cheers,

Giovanni

View 7 Replies View Related

IF Statement Troubles

Feb 28, 2008

I have just about figured everything out except for 2 things.

First sometimes there will not be a ‘177’ record. How can I structure my IF statement so I can bypass the code. Other wise it creates a hdr and a blank detail record? Or is there another conditional verb I can use that might be better?

Second I can’t get my cnt to show up in my hdr records. The print statement is not even showing them. What am I doing wrong?

Any ideas?
Thanx in advance,

Here's my code:
DECLARE @Cnt int
DECLARE @Sys varchar (4);

DECLARE @vwSys varchar (4), @vwPrin varchar (4)
/* Define Cursor */
/*Works like an ARRAY*//*holds current record */
Declare vwCursor CURSOR FOR
SELECT Sys, Prin FROM dbo.vwPrin
ORder by Sys, Prin
open vwCursor
FETCH NEXT FROM vwCursor INTO @vwSys, @vwPrin
print '1st FETCH '
Print @vwSys
Print @vwPrin
SET @Sys = @vwSys

WHILE @@Fetch_Status = 0--34
BEGIN
INSERT INTO tblOutput (Batch_Type, Batch_Num, Sys, Prin, Terminal_id, Op_Code)
SELECT DISTINCT TOP(1) '9', @Cnt, Sys, Prin, Term_Id, Op_Code
FROM dbo.tblTrans
WHERE Sys = @vwSys AND Prin = @vwPrin
INSERT INTO tblOutput (Account_Num, Tran_Code, SubTrans, Terminal_Id, Op_Code)--45
SELECT Account_Number, Transaction_Code, SubTrans, Term_id, Op_Code
FROM dbo.tblTrans
WHERE dbo.tblTrans.Transaction_Code = '020' AND Sys = @vwSys AND Prin = @vwPrin
SET @Cnt = @Cnt + 1
Print @cnt
INSERT INTO tblOutput (Batch_Type, Batch_Num, Sys, Prin, Terminal_id, Op_Code)
SELECT DISTINCT TOP (1) '9', @cnt, Sys, Prin, Term_Id, Op_Code
FROM dbo.tblTrans
WHERE Sys = @vwSys AND Prin = @vwPrin
INSERT INTO tblOutput (Account_Num, Tran_Code, Clerk_Code, Memo_Text)--45
SELECT Account_Number, Transaction_Code, Clerk_Code, Memo_Text
FROM dbo.tblTrans
WHERE dbo.tblTrans.Transaction_Code = '115' AND Sys = @vwSys AND Prin = @vwPrin
SET @Cnt = @Cnt + 1
[b]IF (SELECT Transaction_Code = '177' AND Sys = @vwSys AND Prin = @vwPrin FROM dbo.tblTrans)[/b]
BEGIN
INSERT INTO tblOutput (Batch_Type, Batch_Num, Sys, Prin, Terminal_id, Op_Code)
SELECT DISTINCT TOP (1) '9', @cnt, Sys, Prin, Term_Id, Op_Code
FROM dbo.tblTrans
WHERE Sys = @vwSys AND Prin = @vwPrin
INSERT INTO tblOutput (Account_Num, Tran_Code, SubTrans, SubTrans_2, Terminal_Id, Op_Code)--45
SELECT Account_Number, Transaction_Code, SubTrans, SubTrans2, Term_Id, Op_Code
FROM dbo.tblTrans--55
WHERE dbo.tblTrans.Transaction_Code = '177' AND Sys = @vwSys AND Prin = @vwPrin
SET @Cnt = @Cnt + 1
/*Continue FETCH Command until EOF */
FETCH NEXT FROM vwCursor INTO @vwSys, @vwPrin
print ' 2nd FETCH '
Print @cnt
END
--Print @vwSys
--Print @vwPrin
END
CLOSE vwCursor
DEALLOCATE vwCursor
END

View 8 Replies View Related

SQL Troubles With VPN Connection

Sep 12, 2006

We have an application that connects to a remote site's SQL server using aVPN client. It also uses a local MS SQL database located on one of ourservers. It seems once the VPN connection is established the client machineis always looking to the remote VPN connection/server for it's data. Itested this out by going into the ODBC applet and doing a "TEST CONNECTION"with the VPN client closed. The response was immediate and the connectionworked. Once I established the Internet VPN connection the connectionrepeatedly failed after a several seconds while it appeared to be looking onthe Internet for a local server.What can we do to fix this problem.Thanks,Charles MacleanMTS, Inc.

View 1 Replies View Related

SQL Query Troubles

Oct 13, 2006

Hi guys,

I have an sql query I am getting stuck on for a university assignment. Some background:

The tables of the Database in question are listed below, primary keys are underlined:
Sports (SportCode, SportName)
Events (EventID, SportCode, EventDescription)
Heats (HeatEventID, EventID, HeatCategory)
Fixtures (FixtureID, HeatEventID, FixtureTime, FixtureDate, Location, Field)
Universities (UniID, UniversityName, StateCode)
RegisteredMembers (RegMemberID, MembershipType, FirstName, LastName, Address, Postcode, Gender, UniID)
Teams (TeamID, Division, UniID, TeamName)
TeamMembers (TeamID, RegMemberID)
Results (FixtureID, TeamID, Score, Versus)

Part of this assignment is to use a function to check, when adding a new fixture, that the teams havent: played each other before, or planned to play against each other in the future.

This is done via the Results table, I can pass the two TeamID's from the drop down boxes in the MS Access form into the function, I am wondering what is the best way to find out if the two teams have played each other before? If they have played, or will play each other, there will be two records, one for each team connected to the one FixtureID.

View 1 Replies View Related

Exporting Troubles

Oct 23, 2007

I am trying to export a table from SQL 2005 to excel and I recieve this error:


Error 0xc002f210: Prepearation SQL Task:Executing the query "CREATE TABLE...


Here is the error report:


Operation stopped...

- Initializing Data Flow Task (Success)

- Initializing Connections (Success)

- Setting SQL Command (Success)

- Setting Source Connection (Success)

- Setting Destination Connection (Success)

- Validating (Success)

- Prepare for Execute (Stopped)

- Pre-execute (Stopped)

- Executing (Error)
Messages
* Error 0xc002f210: Preparation SQL Task: Executing the query "CREATE TABLE `customer` (
`company` LongText,
`custid` LongText,
`custnum` Long,
`name` LongText,
`address1` LongText,
`address2` LongText,
`address3` LongText,
`city` LongText,
`state` LongText,
`zip` LongText,
`country` LongText,
`resaleid` LongText,
`salesrepcode` LongText,
`territoryid` LongText,
`shiptonum` LongText,
`termscode` LongText,
`shipviacode` LongText,
`printstatements` Byte,
`printlabels` Byte,
`printack` Byte,
`fincharges` Byte,
`credithold` Byte,
`groupcode` LongText,
`discountpercent` Decimal(6,2),
`primpcon` Long,
`primbcon` Long,
`primscon` Long,
`comment_` LongText,
`estdate` DateTime,
`faxnum` LongText,
`phonenum` LongText,
`taxexempt` LongText,
`aracctid` LongText,
`markupid` LongText,
`billday` Long,
`oneinvperps` Byte,
`defaultfob` LongText,
`creditincludeorders` Byte,
`creditreviewdate` DateTime,
`creditholddate` DateTime,
`creditholdsource` LongText,
`creditclearuserid` LongText,
`creditcleardate` DateTime,
`creditcleartime` LongText,
`edicode` LongText,
`obsolete803_editest` Byte,
`obsolete803_editranslator` LongText,
`character01` LongText,
`character02` LongText,
`character03` LongText,
`character04` LongText,
`character05` LongText,
`character06` LongText,
`character07` LongText,
`character08` LongText,
`character09` LongText,
`character10` LongText,
`number01` Decimal(20,9),
`number02` Decimal(20,9),
`number03` Decimal(20,9),
`number04` Decimal(20,9),
`number05` Decimal(20,9),
`number06` Decimal(20,9),
`number07` Decimal(20,9),
`number08` Decimal(20,9),
`number09` Decimal(20,9),
`number10` Decimal(20,9),
`date01` DateTime,
`date02` DateTime,
`date03` DateTime,
`date04` DateTime,
`date05` DateTime,
`checkbox01` Byte,
`checkbox02` Byte,
`checkbox03` Byte,
`checkbox04` Byte,
`checkbox05` Byte,
`currencycode` LongText,
`countrynum` Long,
`langnameid` LongText,
`bordercrossing` LongText,
`formatstr` LongText,
`btname` LongText,
`btaddress1` LongText,
`btaddress2` LongText,
`btaddress3` LongText,
`btcity` LongText,
`btstate` LongText,
`btzip` LongText,
`btcountrynum` Long,
`btcountry` LongText,
`btphonenum` LongText,
`btfaxnum` LongText,
`btformatstr` LongText,
`parentcustnum` Long,
`taxregioncode` LongText,
`iccust` Byte,
`contbillday` Long,
`emailaddress` LongText,
`shippingqualifier` LongText,
`allocprioritycode` LongText,
`linkportnum` Long,
`webcustomer` Byte,
`customertype` LongText,
`nocontact` Byte,
`territorylock` Byte,
`custurl` LongText,
`pendingterritoryid` LongText,
`extid` LongText,
`consolidateso` Byte,
`bill_frequency` LongText,
`creditincludepi` Byte,
`globalcust` Byte,
`ictrader` Byte,
`taxauthoritycode` LongText,
`externaldeliverynote` Byte,
`globalcredincord` Byte,
`globalcredincpi` Byte,
`globalcurrencycode` LongText,
`externalid` LongText,
`globalcredithold` LongText,
`globallock` Byte,
`checkduplicatepo` Byte,
`creditlimit` Decimal(15,0),
`custpilimit` Decimal(15,0),
`globalcreditlimit` Decimal(15,0),
`globalpilimit` Decimal(15,0),
`docglobalcreditlimit` Decimal(15,0),
`docglobalpilimit` Decimal(15,0),
`rfqattachallow` Byte,
`discountqualifier` LongText,
`number11` Decimal(20,9),
`number12` Decimal(20,9),
`number13` Decimal(20,9),
`number14` Decimal(20,9),
`number15` Decimal(20,9),
`number16` Decimal(20,9),
`number17` Decimal(20,9),
`number18` Decimal(20,9),
`number19` Decimal(20,9),
`number20` Decimal(20,9),
`date06` DateTime,
`date07` DateTime,
`date08` DateTime,
`date09` DateTime,
`date10` DateTime,
`date11` DateTime,
`date12` DateTime,
`date13` DateTime,
`date14` DateTime,
`date15` DateTime,
`date16` DateTime,
`date17` DateTime,
`date18` DateTime,
`date19` DateTime,
`date20` DateTime,
`checkbox06` Byte,
`checkbox07` Byte,
`checkbox08` Byte,
`checkbox09` Byte,
`checkbox10` Byte,
`checkbox11` Byte,
`checkbox12` Byte,
`checkbox13` Byte,
`checkbox14` Byte,
`checkbox15` Byte,
`checkbox16` Byte,
`checkbox17` Byte,
`checkbox18` Byte,
`checkbox19` Byte,
`checkbox20` Byte,
`shortchar01` LongText,
`shortchar02` LongText,
`shortchar03` LongText,
`shortchar04` LongText,
`shortchar05` LongText,
`shortchar06` LongText,
`shortchar07` LongText,
`shortchar08` LongText,
`shortchar09` LongText,
`shortchar10` LongText,
`allowaltbillto` Byte,
`demanddeliverydays` Long,
`demanddatetype` LongText,
`demandaddleadtime` Long,
`demandaddaction` LongText,
`demandchangeleadtime` Long,
`demandchangeaction` LongText,
`demandcancelleadtime` Long,
`demandcancelaction` LongText,
`demandnewlineleadtime` Long,
`demandnewlineaction` LongText,
`demandqtychangeleadtime` Long,
`demandqtychangeaction` LongText,
`demandchangedateleadtime` Long,
`demandchangedateaction` LongText,
`tradingpartnername` LongText,
`resdelivery` Byte,
`satdelivery` Byte,
`satpickup` Byte,
`hazmat` Byte,
`doconly` Byte,
`refnotes` LongText,
`applychrg` Byte,
`chrgamount` Decimal(16,2),
`cod` Byte,
`codfreight` Byte,
`codcheck` Byte,
`codamount` Decimal(16,2),
`groundtype` LongText,
`notifyflag` Byte,
`notifyemail` LongText,
`declaredins` Byte,
`declaredamt` Decimal(16,2),
`periodicitycode` Long,
`servsignature` Byte,
`servalert` Byte,
`servhomedel` Byte,
`deliverytype` LongText,
`servdeliverydate` DateTime,
`servphone` LongText,
`servinstruct` LongText,
`servrelease` Byte,
`servauthnum` LongText,
`servref1` LongText,
`servref2` LongText,
`servref3` LongText,
`servref4` LongText,
`servref5` LongText,
`earlybuffer` Long,
`latebuffer` Long,
`demandunitpricediff` Byte,
`demandunitpricediffaction` LongText,
`excfromval` Byte,
`addressval` Byte,
`rebatevendornum` Long,
`rebateform` LongText,
`creditcardorder` Byte,
`demandcheckforpart` Byte,
`demandcheckforpartaction` LongText,
`changedby` LongText,
`changedate` DateTime,
`changetime` Long,
`chargecode` LongText,
`individualpackids` Byte,
`intrntlship` Byte,
`certoforigin` Byte,
`commercialinvoice` Byte,
`shipexprtdeclartn` Byte,
`letterofinstr` Byte,
`ffid` LongText,
`ffcompname` LongText,
`ffaddress1` LongText,
`ffaddress2` LongText,
`ffaddress3` LongText,
`ffcity` LongText,
`ffstate` LongText,
`ffzip` LongText,
`ffcountry` LongText,
`ffcountrynum` Long,
`ffphonenum` LongText,
`nonstdpkg` Byte,
`deliveryconf` Long,
`addlhdlgflag` Byte,
`upsquantumview` Byte,
`upsqvshipfromname` LongText,
`upsqvmemo` LongText,
`upsqvemailtype` LongText,
`ffcontact` LongText,
`etcaddrchg` Byte,
`PROGRESS_RECID` Decimal(19,0),
`PROGRESS_RECID_IDENT_` Decimal(19,0)
)
" failed with the following error: "Too many fields defined.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
(SQL Server Import and Export Wizard)


- Copying to `customer` (Stopped)

- Post-execute (Stopped)

- Cleanup (Stopped)


I am new to SQL so any help would be greatly appreciated.

View 1 Replies View Related

SRS Installation Troubles

May 30, 2007

I am getting problem when i try to browse the reports, it displays the following error messages:

-

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


Refresh button, or try again later.


A name was started with an invalid character. Error processing resource 'http://localhost/Reports/'. Line 1, Position 2 <%@ Page language="c#" Codebehind="Home.aspx.cs" AutoEventWireup="false" Inherits="Microsoft.ReportingServices.UI.HomePag...The installation process seems to work without any issues, however we cannot see http://localhost/reportserver/

View 7 Replies View Related

Login Troubles

Mar 18, 2007

I've installed SQL server express on a remote server. Using remote desktop, I can log in using Windows Authetication.

But I also want to be able to login remotely. Using Server Management Express I've added a new login and specified the password for SQL server authentication. My problem is that the password keeps getting changed to a mystery 15 character value.

What's going on?

View 1 Replies View Related

Pager Troubles

Jan 16, 2008

Hello everybody!

I'm fighting with report's HTML view for a week, and i cannot overcome it. The problem is wrong pager spliting. Having changed a lot of controls properties i acheived correct pagination while exporting to PDF format (it gives me 4 pages in A4 format).

But HTML pagination haven't changed at all. It gives me 2 large pages. And whatever i change it gives me the same 2 pages.

Has somebody deal with that?

Thanks for any help!

View 3 Replies View Related

Is The Transaction Context Available Within A 'called' Stored Procedure For A Transaction That Was Started In Parent Stored Procedure?

Mar 31, 2008

I have  a stored procedure 'ChangeUser' in which there is a call to another stored procedure 'LogChange'. The transaction is started in 'ChangeUser'. and the last statement in the transaction is 'EXEC LogChange @p1, @p2'. My questions is if it would be correct to check in 'LogChange' the following about this transaction: 'IF @@trancount >0 BEGIN Rollback tran' END Else BEGIN Commit END.
 Any help on this would be appreciated.

View 1 Replies View Related

Troubles With SQL Like Statement With More Then One Word

Jan 12, 2007

Im having a slight problem with my Like statement, I'm just building a simple search/match routine. I have the following SQL statement SELECT TOP(4) tags FROM post WHERE atags LIKE '%test%'that statement is ok, it will return many results with test in it but if I add more then one search word like LIKE '%+test test2+%' or LIKE '%+test%test2+%'  All I seem to get is results that only have the exact two tags not any others that may have one of them.How can I get it to display all records that have an instance of any of those words. Any help would be much appreciated.  

View 14 Replies View Related

Troubles With Logging On SQL Server

Jan 23, 2005

I've got a problem here logging on mssql server
It seems to me that the problem is in ConnectionString
When I add new connection to the project via Microsoft OLEDB provider for SQL Server
I use login 'sa' and password 'pwd'. Then if I check 'Allow saving password' (or something like that - i use other language) everything works fine, but if i don't at last I get an error message
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'sa'.
Source Error:
...
Line 47: Me.SqlCommand1.Connection.Open()
...
Can I use connection string with no explicit inclusion of password?
TIA

View 2 Replies View Related

Nested Query Troubles...

Jan 26, 2006

Hi All,

Can anybody please tell me if a query such as this (Valid in MS Access)
can work in SQL Server:


SELECT Description, Sum(Total) FROM (
SELECT Description, Total FROM Table_A
UNION ALL
SELECT Description, Total FROM Table_B
UNION ALL
SELECT Description, Total FROM Table_C
)
GROUP BY Description


The group of unions work by themselves, but when I try to nest an outer query to do some a Summation(), I have syntax errors.

Any insight would be greatly appreciated. Thank you.

View 2 Replies View Related

SqlExpress Vista Troubles #3

Sep 13, 2007

This what happened in Vista. I just set up my SqlServer Express (SSMS), attached my databases: all of them except one.

The reason why it happened is that when I copied my folder with DBs from XP to Vista I found out that one mdf file was missing.There was the log file for that DB intact. It is a somewhat secondar database (at leas temporary until I will have resolved some tricky issues in C# app, then it will get full load). When I bagan chenging my conn strings in C# to accomodate new Vista's tastes I realized that that DB was not attached to VS 2005 either. I began to investigate.

I went to XP and checked thoroughly. First I thought this DB (mdf file for this DB) was stored in another partition. It does not seem to be the case. The entire disk was searched: nothing found.

The weird thing is: I can see this DB in SSMS in XP with ALL tables intact. I opened the design and also opened the tables. The values are all there. This is my first question: how can it be explained? Could it be that all the tables are in the log file for this DB?

So at this point I have no way to copy the DB from XP to Vista the way I did before with other DBs.

The next problem is this:

I went to Vista and tried to restore this DB from a backup. The backup may not be too fresh but I do not care. All I need is the structures and stored procedures. Vista gives me hard time.

This is my code:


RESTORE DATABASE [intraDay] FROM DISK = 'J:SqlServerBackUpsIntraDayintraDayFullRM.BAK' WITH RECOVERY,

TO 'C:intraDay.mdf'; -- this is just to try the RESTORE in principle. I will restore the DB to a different folder.

GO

I get an error that


Msg 156, Level 15, State 1, Line 2

Incorrect syntax near the keyword 'TO'.

I understand that the MOVE clause may be missing. I tried that but got in trouble with it as well.

Will appreciate any help.

I've never done RESTORE before.

Thanks.

View 3 Replies View Related







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