Whats Better?

Jul 20, 2005

<usualDisclaimer>Please forgive me if this is in the wrong group, and if so,
what is the right group.</usualDisclaimer>

Let me start off by first saying im a newb. Ok, with that out of the way I
am trying really hard and boy have I learned a lot in the last little while
but I have a question i just can't seem to find a good answer to.

Lets say i have a table that simply stores how many times someone has logged
into a webpage. Is it better to store each login as a new record then count
the records or is it better to simply have one record that updates the total
value by incrementing that one field. I have read all manner of articles
and some say one way is better vs. the other but what I can't find is why?
If I knew why one way was better than another then I could make and educated
decision and choose the best way that is right for me. Is updating more or
less expensive then inserting? Does it matter and is a relevant question?

And before anyone comments on my use of all uppercase letters for my table
name I do this so that my table names stand out within the sql server
enterprise manager. In other words system tables are lowercase and my
tables are uppercase. People always seem to give me crap for this but never
back it up with a good explanation so far as I can tell its personal
preference? Am I wrong?

CREATE TABLE USER_METRICS
(
-- here i can select all the records and count them up.
ID INT IDENTITY(1,1) PRIMARY KEY,
Email VARCHAR(250)
);

-- Or this?

CREATE TABLE USER_METRICS
(
-- and of course here can i simply retrieve the value of Total_Logins
ID INT IDENTITY(1,1) PRIMARY KEY,
Email VARCHAR(250) NOT NULL,
Total_Logins INT
);


Regards,
Muhd

View 3 Replies


ADVERTISEMENT

Whats Wrong In This...

Sep 12, 2007

Hello DBA's 
i use this proc to insert & update the records in the databse
update works good untill i change the user id.  
userid can be changed where adminuserid is the IDENTITY coulmn in the table.ALTER PROCEDURE [dbo].[spinsertusers]
-- Add the parameters for the stored procedure here
@adminuserid varchar(36),
@userid varchar(15),
@fname varchar(25),
@mname varchar(25),
@lname varchar(25),
@password varchar(15),
@address1 varchar(255),
@address2 varchar(255),
@postcode varchar(15),
@cityidentity varchar(36),
@dob smalldatetime ,
@email varchar(50),
@crtduser varchar(36),
@crtdon datetime,
@isactive char(4),
@mode char(10),
@reccount INT output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @Count INT
-- Insert statements for procedure here
IF (@mode='insert')
SET @Count=(SELECT COUNT(*) FROM adminusermaster WHERE userid=@userid)
IF @count=0
--Inserting the Records
BEGIN
INSERT INTO [school].[dbo].[AdminUserMaster]
([AdminUserIdentity]
,[FirstName]
,[MiddleName]
,[LastName]
,[UserID]
,[Password]
,[Address1]
,[Address2]
,[PostCode]
,[CityIdentity]
,[DOB]
,
,[CreatedBy]
,[CreatedOn]
,[IsActive])
VALUES
(
@adminuserid ,
@fname ,
@mname ,
@lname ,
@userid ,
@password,
@address1,
@address2,
@postcode,
@cityidentity ,
@dob,
@email,
@crtduser,
@crtdon ,
@isactive
)
SET @reccount=2
return @reccount
END

-- End of Query
IF (@mode='update')

SET @Count=(SELECT COUNT(*) FROM adminusermaster WHERE userid=@userid)
IF @Count=1
--Query for Update the Records
BEGIN
update AdminUserMaster
set
[FirstName]=@fname ,
[MiddleName] =@mname,
[LastName]=@lname,
[userid]=@userid ,
[Address1]=@address1,
[Address2]=@address2,
[PostCode]=@postcode,
[CityIdentity]=@cityidentity,
[DOB]=@dob,
=@email,
ModifiedBy=@crtduser ,
ModifiedOn=@crtdon ,
isactive='Y'
where
AdminUserIdentity= @adminuserid
set @reccount=3
return @reccount
END

-- End of Query
END





 
 

View 3 Replies View Related

DBO Or MDF Whats The Diffrence?

May 11, 2008

]First of all here is how i created my SQL database and established a connection in visual studio 05. I go into the server explorer and right click on the data connections node and and select "create new SQL database". A window then prompts me for a server name and data base name. Under server name I write "localhostSQLEXPRESS" and under data base name I put in whatever. This totally worked and the database was asigned the extension of .DBO
I can now insert, select and delete information with some simple ADO coding. The only problem is that using this method makes it seamingly impossible to FTP my database onto my host server.  I am aware that I can create a data base in the APP folder by simply right clicking it and selecting " new database".
This would simplify the deploying process but I cant seem to establish a connection this way. Ive also noticed that when I use this method that it saves it as a .MDF instead of a .DBO. What is the difference? Why does my .DBO work but not my .MDF in my app folder? Im so confused over this issue that I am problably not even asking the right question. Bottom line is that I have a small web application with a .dbo database that works wonderfully in my isolated visual studio environment and I need a solution to deploy it on the world wide web.  Please help with any information I would be very thankfull.

View 15 Replies View Related

Whats The Difference

Feb 2, 2004

Between having SQL and using SQL server enterprise manager with MSDE

View 1 Replies View Related

Whats Wrong With This Sp?

Aug 11, 2004

I am not an expert with sp. I am trying to pass the column name as a parameter but I get the following error "Must declare the variable '@strColumnName'."

ALTER PROCEDURE dbo.TempGetDataForDropDown
(
@strColumnNamenvarchar (50)
)
as

EXEC ('SELECT DISTINCT @strColumnName = ' + @strColumnName + ' FROM Customers')

View 1 Replies View Related

Whats Wrong In This

Oct 3, 2006

SELECT 'http=' replace (prot,'ww','+')',+'replace(city,'u','+')',+'proj_s tate'+'proj_zip5
INTO :ls_MAP FROM project4 WHERE proj_id=:gv_proj_id;

View 4 Replies View Related

Whats Too Many Records?

Jan 9, 2004

Hi all,
I've recently created a shopping cart system that uses SQL Server on the backend. The shopping cart will add a record to a table called CartEvents each time anything happens, like view item, update, delete etc. anyhow, the site has been up for about a week now and that particular table has about 4200 records already, I project tens of thousands of records in that table, so how many records is too many records? Whats your experience with tables that have hundreds of thousands of records? How many records can SQL server handle and still perform well?

Thanks

View 4 Replies View Related

What Is ALL,SOME|ANY ? Whats The Usage?

Jun 5, 2008

What is ALL,SOME|ANY ? Whats the usage?

Is they are comparison operators?
If not then what kind?

If SOME and ANY are same then where to use SOME and where to use ANY?

View 2 Replies View Related

Whats The Server Name

Jun 23, 2008

Im using windows xp sp2 and MS Sql server 2005 enterprise edition may b and im also havin sql server express
previously when i installed sql server express it took server name on its own and i used to run queries using AdventureWorks database..
Recently i formated my desktop and again installed both the versions im having but neither is taking server name.. and i dint noticed what was the server name before.. im a student home user i just hav to query on adventurework databases on the same computer i cant afford to buy any servers..
so can anyone tell me how can i configure sql so that i can query !

View 1 Replies View Related

Whats Wrong Here??

Nov 17, 2006

DECLARE @DBName varchar(100);
SET @DBName = 'TestTest';

CREATE DATABASE @DBName ON PRIMARY;


message is: wrong syntax near '@DBName'.

View 8 Replies View Related

Whats The Difference?

Nov 22, 2007

I've been writing a few sql queries over the past few days, and would like to know what the difference is between:

website is null

website like ''

Becasue if they mean different things i want to know how to look them both up at the same time. Obv im after data that is blank or has nothing written in it.

View 6 Replies View Related

Whats Wrong With This SQL

Mar 21, 2008

I am trying to run an sql query with a function in SQL SERVER MANAGEMENT STUDIO and am getting the following error.

Msg 207, Level 16, State 1, Line 9
Invalid column name 'UserID'.

here is my Query
-----------------
USE vportal4vsearch
GO
CREATE FUNCTION dbo.ConcatUserGroups(@UserID int)
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @groupname Varchar(2000)
SELECT @groupname = COALESCE(u.group_name + ', ', '') + CONVERT(varchar(20), u.group_name)
FROMdbo.[user] A
JOIN dbo.UserGroup_combo UG
ON UG.ug_userID = a.USER_ID
JOIN dbo.usergroup U
ON UG.ug_groupID = u.group_ID
WHEREA.USER_ID = @UserID
ORDER BY U.GROUP_NAME

RETURN @groupname
END
GO
SELECT
user_ID,
user_Firstname,
user_Lastname,
user_Email,
Username = (Case When user_Username = ' ' or user_username is Null then 'None' else User_Username end),
user_creationdate,
Active = (Case When user_Active = 1 then 'Yes' else 'No' end),
dbo.ConcatUserGroups(UserID),
TheatreCode = (Case When User_TheaterCode = ' ' or User_TheaterCode is Null then 'N/A' else User_TheaterCode end),
JobTitle = (Case When user_JobTitle = ' ' or User_Jobtitle is Null then 'N/A' else User_Jobtitle end)
FROM [user]
GO
DROP FUNCTION dbo.ConcatUserGroups
GO

View 6 Replies View Related

Any One Know Whats Wrong With It

Jan 14, 2006

[CODE]

 

Private Sub pulllikehell()
        Dim cn As SqlCeConnection
        Dim rda As SqlCeRemoteDataAccess = Nothing
        Dim sqlEngine As SqlCeEngine

        Try

            ' Create database if it doesn't already exist
            If (Not File.Exists("My DocumentsORDER.sdf")) Then
                sqlEngine = New SqlCeEngine
                sqlEngine.LocalConnectionString = "Data Source=My DocumentsORDER.sdf;"

                sqlEngine.CreateDatabase()
                sqlEngine.Dispose()
            Else
                ' Open the connection to the database
                cn = New SqlCeConnection("Data Source=My Documents" & _
                                         "ORDER.sdf:")
                cn.Open()
                Dim cmd As SqlCeCommand = cn.CreateCommand()

                ' Drop the FieldMemos table
                cmd.CommandText = "DROP TABLE STAFF"
                cmd.ExecuteNonQuery()

                ' Close the connection

            End If

            ' Instantiate the RDA Object
            rda = New SqlCeRemoteDataAccess
            ' Connection String to the SQL Server.
            Dim remoteConnectString As String = "Provider=SQLOLEDB;" & _
                                                "Data Source=KANGALERT/SQLEXPRESS;" & _
                                                "Initial Catalog=ORDER;"

            rda.InternetLogin = ""
            rda.InternetPassword = ""
            rda.InternetUrl = "http://kangalert/server/sqlcesa30.dll"
            rda.LocalConnectionString = "Data Source=My Documents" & _
                                        "ORDER.sdf;"


            rda.Pull("STAFF", "Select * from STAFF", remoteConnectString, _
             RdaTrackOption.TrackingOnWithIndexes)
            MsgBox("ok")

        Catch sqlex As SqlCeException
            Dim sqlError As SqlCeError
            For Each sqlError In sqlex.Errors
                MessageBox.Show(sqlError.Message)
            Next
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            rda.Dispose()
        End Try

    End Sub

[/CODE]

computer server name is kangalert

and got 2 sqlservice run in my pc,  SQLEXPRESS  and MSSQLSERVER

DATABASE NAME IS ORDER with a TABLE call STAFF

when come to this statement

rda.LocalConnectionString = "Data Source=My DocumentsORDER.sdf"

ERROR MESSAGE: A request to send data to the computer running IIS has failed. For more information, see HRESULT.

 when come to this statement

rda.Pull("STAFF", "Select * from STAFF", remoteConnectString, _
             RdaTrackOption.TrackingOnWithIndexes)

ERROR MESSAGE :A required property is not specified. [ Property name = SubscriberConnectionString ]

HOPEFULLY ANYONE CAN HELP ME SOLVE IT. THANKS IN ADVANCE

View 3 Replies View Related

Whats Wrong With My SP

Aug 25, 2006

Whats wrong with my stored procedure i thought i am declaring the varible when i write this check it out can some one help me out thanks!!!!



CREATE PROCEDURE dbo.GetCompanyDEMO
[

@CompanyName nvarchar(40)
]

As

Select ContactName, ContactTitle, Address, City, Region, Phone
FROM Customers C
Where C.CompanyName = @CompanyName

View 3 Replies View Related

Some One Tell Me What Is Trigger And Whats The Use Of It? And When Do I Use It?

Mar 6, 2008

some one tell me what is trigger and whats the use of it? and when do i use it?

some one show me demo , example of trigger

thank u

maxs

View 10 Replies View Related

Complex Query, Whats The Best Way?

May 15, 2007

I have a query that must return information for an invoice. It is not straight forward though. Some things need to be displayed from the if something else is happening...
For example...declare @id int
declare @chargeid int
set @id = 1
set @chargeid = 9

declare @pp bit, @pages int, @pagefee money, @pagecharge money
set @pp = (select perpage from tblmainfees where mainfeesid = @chargeid)
if (@pp = 1)
begin
set @pages = (select pages from tblcharges inner join tblrequest on requestid = fkrequestid where requestid = @id)
if (@pages > 0)
begin
set @pagefee = (select perpagefee from tblmainfees where mainfeesid = @chargeid)
set @pagecharge = (@pages * @pagefee)
end
end
...

select @pagecharge as PerPageCharge

 
Or should I do some complex query with only one select?

View 4 Replies View Related

Sql Data Source...whats Best

May 17, 2007

Im a bit confused as to what is best.
I have a web site built in c# web dev which utilises a data base.
What is best practise ...........
1.    To have one sql data source on one page and all other pages use that source.
2..   each page has its own source and connection string depending on its data requirements.
3.....  have no source and use insert statements with stored procedures because most of my site extracts data from visitors
rather than displaying data to them.
If I have this right.......the data source is a copy of the data base that is available for use to the visitor
or is it just part of the connection to the data base.
 My only gripe with the whole development process has been the discovery that I have learnt
four ways of doing the same thing.......which in its self becomes confusing..
However one thing has stood above all else ........this forum
richard 

View 2 Replies View Related

Whats Wrong With This Query

Nov 8, 2007

 1 SELECT
2 RowNumber,
3 'Source.Dbf, Plan.Dbf',
4 'Source Name is missing for Source Number "' + IsNull(RTrim(f.SOURCE_NUM),'Unknown') + '" in Plan.Dbf table.'
5 FROM
6 SourceDbf f
7 JOIN
8 (
9 SELECT DISTINCT
10 SOURCE_NUM,
11 (Select CASE s.SOURCE_NUMWhen 1 Then SRC1NAME
12 WHEN 2 Then SRC2NAME
13 WHEN 3 THEN SRC3NAME
14 WHEN 4 THEN SRC4NAME
15 WHEN 5 THEN SRC5NAME
16 WHEN 6 THEN SRC6NAME
17 WHEN 7 THEN SRC7NAME
18 WHEN 8 THEN SRC8NAME
19 WHEN 9 THEN SRC9NAME
20 WHEN 10 THEN SRC10NAME
21 WHEN 11 THEN SRC11NAME
22 WHEN 12 THEN SRC12NAME
23 WHEN 13 THEN SRC13NAME
24 WHEN 14 THEN SRC14NAME
25 WHEN 15 THEN SRC15NAME
26 END
27 FROM
28 PlanDBF p
29 Where
30 p.PLAN_NUM = s.PLAN_NUM
31 ) as SourceName
32 FROM
33 SourceDBF s ) c on f.PLAN_NUM = c.PLAN_NUM

 i am getting an error on Line 33 and this what the error says...
Msg 207, Level 16, State 1, Line 33Invalid column name 'PLAN_NUM'.
 
Any help will appreciated..
Regards
Karen

View 17 Replies View Related

Whats Wrong With This Statement

Nov 16, 2007

I am getting an error Msg 8155, Level 16, State 2, Procedure usp_ImportNewASC_ParticipantPlanFundBalances, Line 1No column was specified for column 49 of 'a'.I think its something to do with the line number  48 and 102 ALLOC_PER is char(9) so i want to to cast it as a int and insert into the prodction data. 1 UPDATE
2 Statements..ParticipantPlanFundBalances1
3 SET
4 Act1 = ACT_ID1,
5 TotAct1 = TOT_ACT1,
6 Act2 = ACT_ID2,
7 TotAct2 = TOT_ACT2,
8 Act3 = ACT_ID3,
9 TotAct3 = TOT_ACT3,
10 Act4 = ACT_ID4,
11 TotAct4 = TOT_ACT4,
12 Act5 = ACT_ID5,
13 TotAct5 = TOT_ACT5,
14 Act6 = ACT_ID6,
15 TotAct6 = TOT_ACT6,
16 Act7 = ACT_ID7,
17 TotAct7 = TOT_ACT7,
18 Act8 = ACT_ID8,
19 TotAct8 = TOT_ACT8,
20 Act9 = ACT_ID9,
21 TotAct9 = TOT_ACT9,
22 Act10 = ACT_ID10,
23 TotAct10 = TOT_ACT10,
24 Act11 = ACT_ID11,
25 TotAct11 = TOT_ACT11,
26 Act12 = ACT_ID12,
27 TotAct12 = TOT_ACT12,
28 Act13 = ACT_ID13,
29 TotAct13 = TOT_ACT13,
30 Act14 = ACT_ID14,
31 TotAct14 = TOT_ACT14,
32 Act15 = ACT_ID15,
33 TotAct15 = TOT_ACT15,
34 Act16 = ACT_ID16,
35 TotAct16 = TOT_ACT16,
36 Act17 = ACT_ID17,
37 TotAct17 = TOT_ACT17,
38 Act18 = ACT_ID18,
39 TotAct18 = TOT_ACT18,
40 Act19 = ACT_ID19,
41 TotAct19 = TOT_ACT19,
42 Act20 = ACT_ID20,
43 TotAct20 = TOT_ACT20,
44 OpeningUnits = UNIT_OP,
45 OPricePerUnit = PRICE_OP,
46 ClosingUnits = UNIT_CL,
47 CPricePerUnit = PRICE_CL,
48 AllocationPercent = i.ALLOC_PER1
49
50 FROM
51 Statements..ParticipantPlanFundBalances1 pfb
52 JOIN (
53 Select
54 cp.PlanId,
55 p.ParticipantId,
56 @PeriodId Period,
57 f.FundId,
58 a.ACT_ID1,
59 a.TOT_ACT1,
60 a.ACT_ID2,
61 a.TOT_ACT2,
62 a.ACT_ID3,
63 a.TOT_ACT3,
64 a.ACT_ID4,
65 a.TOT_ACT4,
66 a.ACT_ID5,
67 a.TOT_ACT5,
68 a.ACT_ID6,
69 a.TOT_ACT6,
70 a.ACT_ID7,
71 a.TOT_ACT7,
72 a.ACT_ID8,
73 a.TOT_ACT8,
74 a.ACT_ID9,
75 a.TOT_ACT9,
76 a.ACT_ID10,
77 a.TOT_ACT10,
78 a.ACT_ID11,
79 a.TOT_ACT11,
80 a.ACT_ID12,
81 a.TOT_ACT12,
82 a.ACT_ID13,
83 a.TOT_ACT13,
84 a.ACT_ID14,
85 a.TOT_ACT14,
86 a.ACT_ID15,
87 a.TOT_ACT15,
88 a.ACT_ID16,
89 a.TOT_ACT16,
90 a.ACT_ID17,
91 a.TOT_ACT17,
92 a.ACT_ID18,
93 a.TOT_ACT18,
94 a.ACT_ID19,
95 a.TOT_ACT19,
96 a.ACT_ID20,
97 a.TOT_ACT20,
98 a.UNIT_OP,
99 a.PRICE_OP,
100 a.UNIT_CL,
101 a.PRICE_CL,
102 Cast(i.ALLOC_PER1 as int)
103 FROM
104 ASDBF a
105 -- Derive the unique PlanId from the Statements ClientPlan table
106 INNER JOIN Statements..ClientPlan cp
107 ON a.PLAN_NUM = cp.ClientPlanId
108 AND
109 cp.ClientId = @ClientId
110 -- Derive the unique ParticipantId from the Statements Participant table
111 INNER JOIN Statements..Participant p
112 ON a.PART_ID = p.PartId
113 --Derive the unique FundID from the Statements Fund Table...
114 INNER JOIN Statements..Fund f
115 ONa.FUND_ID = f.Cusip
116 OR
117 a.FUND_ID = f.Ticker
118 OR
119 a.FUND_ID = f.ClientFundId
120 -- get the allocation percent from the INVSRC
121 LEFT Outer JOIN INVSRC i
122 ONa.FUND_ID = i.INV_ID
123 AND
124 a.PLAN_NUM = i.Plan_Number
125 AND
126 a.PART_ID = i.PART_ID
127 --INNER JOIN Statements..AscActCodes as
128 --ON
129
130 WHERE
131 a.Import = 1
132 )a
133 ON pfb.PlanId = a.PlanId
134 AND
135 pfb.ParticipantId = a.ParticipantId
136 AND
137 pfb.PeriodId = PeriodId
138 AND
139 pfb.FundId = a.FundId
140
 
Any help will be appreciated
Regards
Karen

View 6 Replies View Related

Whats Wrong With This Query

Nov 20, 2007

I have tried running this query multiple times with no success I get the following errorIncorrect syntax near '('.I tried with quotes and without quotes around the 10 and also without the brackets around variable. It runs when an integer in entered in the variables place but that is not what I want. What am I doing wrong   DECLARE @p AS intSET @p='10'SELECT TOP (@p)* FROM my_tbl order by newid()

View 3 Replies View Related

Whats Wrong With My Script??

Jan 5, 2008

Server Error in '/reputation' Application.


Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30456: 'InserParameters' is not a member of 'System.Web.UI.WebControls.SqlDataSource'.Source Error:





Line 15: registrationDataSource.InsertCommand = "INSERT TO Reputation (firstname, lastname)VALUES(@First Name, @Last Name)"
Line 16:
Line 17: registrationDataSource.InserParameters.Add("firstname", firstname.txt)
Line 18: registrationDataSource.InserParameters.Add("lastname", lastname.txt)
Line 19: Source File: C:UsersQaiphyx
eputationDefault.aspx.vb    Line: 17
Show Detailed Compiler Output:

View 1 Replies View Related

Whats Wrong With My Query

May 19, 2008

strCommand = "SELECT * FROM tblevents WHERE startingDate=#"&startDate &"# AND eventtitle like '%"&criteria &"%' ORDER BY " &sSortSt I want to find any records that match a certain keyword on a specific date... But nothing comes up even though there is an event matching that criteria on the given date. Do I need brackets around my query or something?  

View 6 Replies View Related

Whats In A Connections String?

Mar 25, 2004

I have SQL, I was an MS Access Developer. In Access connection string are easy. But SQL they are more detailed. I just want to know how do I find:
Server Name - server=localhost
User Id - uid=sa
Password - pwd=secret;
Database Name - I know the database name
Please some insight.

View 2 Replies View Related

Whats Wrong Here 7370

Jun 9, 2000

EXEC sp_addlinkedserver
@server = 'LinkedServer', --Server Name
@provider = 'Microsoft.Jet.OLEDB.4.0', --Provider Name
@srvproduct = 'OLE DB Provider for Jet', --Product
@datasrc = 'C:DataX2000Master.mdb' --Data Source

Before the above query was okay.....
I used to run the same query as I today ran but I got this error message, any help pls.....


Server: Msg 7370, Level 16, State 2, Line 1
One or more properties could not be set on the query for OLE DB provider 'Microsoft.Jet.OLEDB.4.0'. The provider could not support a required property.

View 2 Replies View Related

Whats The Best Way To Store Multiple IDs?

May 17, 2008

I'm working on an mini intranet site for a "University" type style. I have a table called "events" which stores information. One of my columns is "eventRSVP" which stores the employees ID's who click on the button, separated by a comma.

example:
Quote: 1751,2179,1371,2314,1778,702,1607,798,2097 Would it be better to create a new table called something like "event_jn" and it has 3 columns.

Quote: ---------------------------
| jnID | jnEVENT | jnEMP |
---------------------------
| 1 | 3 | 2097 |
---------------------------

I'm also redoing our whole intranet and would be doing a lot of these similar type id linking. So my other question is, the more tables I have, is it going to slow down the response time?

Appreciate any insight that can be given!

TIA!

View 3 Replies View Related

Could Someone Tell Me Whats Wrong With This Code?

Jun 25, 2004

I cant get this to work for some reason i am clueless, here is my code:

And here is the error:
//////////////////////////////////////////////////////////
ADODB.Recordset error '800a0e79'

Operation is not allowed when the object is open.

/home/details.asp, line 106
/////////////////////////////////////////////////////////

Begin Code:

/////////////////////////////////////////////////////////
<%
Color = "#05D1B8"
rma_id = Request.QueryString("rma_id")
SQL = "SELECT * FROM TBL_RMA WHERE RMA_ID='"&rma_id&"'"
rs.open SQL, Conn
If Not rs.BOF Then
%>
<table>
<tr>
<td bgcolor="<%=Color%>">RMA ID</td>
<td bgcolor="<%=Color%>">DATE GENERATED</td>
</tr>
<tr>
<td><%=rs("RMA_ID")%></td>
<td><%=rs("RMA_DATE_GENERATED")%></td>
</tr>
</table>
</br>
<table>
<tr>
<td bgcolor="<%=Color%>">RMA STATUS</td>
</tr>
<tr>
<td><%=rs("RMA_STATUS_ID")%></td>
</tr>
</table>
<br>
<table>
<tr>
<td bgcolor="<%=Color%>">PART NUMBER</td>
<td bgcolor="<%=Color%>">DESCRIPTION</td>
<td bgcolor="<%=Color%>">SERIAL NUMBER</td>
</tr>
<tr>
<td><%=rs("RMA_PRODUCT_ID")%></td>
<td><%=rs("RMA_PRODUCT_ID_DESCRIPTION")%></td>
<td><%=rs("RMA_SERIAL_NUMBER")%></td>
</tr>
</table>
<br>
<table>
<tr>
<td bgcolor="<%=Color%>">RECEIVED DATE</td>
<td bgcolor="<%=Color%>">PRIORITY</td>
<td bgcolor="<%=Color%>">TRANSACTION</td>
</tr>
<tr>
<td><%=rs("RMA_PRODUCT_ARRIVAL_DATE")%></td>
<td><%=rs("RMA_PRIORITY_ID")%></td>
<td><%=rs("RMA_TRANSACTION_TYPE_ID")%></td>
</tr>
</table>
<table>
<tr>
<td bgcolor="<%=Color%>">PROBLEM DESCRIPTION</td>
</tr>
<tr>
<td><%=rs("RMA_PROBLEM_DESCRIPTION")%></td>
</tr>
</table>
<br>
<table>
<tr>
<td bgcolor="<%=Color%>">TO MFG</td>
<td bgcolor="<%=Color%>">VIA</td>
<td bgcolor="<%=Color%>">MFG RA</td>
</tr>
<tr>
<td><%=rs("RMA_TO_MFG_DATE")%></td>
<td><%=rs("RMA_TO_MFG_VIA")%></td>
<td><%=rs("RMA_TO_MFG_RA")%></td>
</tr>
<tr>
<td bgcolor="<%=Color%>">FROM MFG</td>
<td bgcolor="<%=Color%>">VIA</td>
</tr>
<tr>
<td><%=rs("RMA_FROM_MFG_DATE")%></td>
<td><%=rs("RMA_FROM_MFG_VIA")%></td>
</tr>
</table>
<table>
<tr>
<td bgcolor="<%=Color%>">PROBLEM FOUND</td>
</tr>
<tr>
<td><%=rs("RMA_PROBLEM_FOUND")%></td>
</tr>
</table>
<%
Else
Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
End If
If rs.EOF Then
rs.Close
End If
%>
<%
rma_id = Request.QueryString("rma_id")
CUSTOMER_ID = session("CUSTOMER_ID")
SQL = "SELECT * FROM tracking_export.csv WHERE CUSTOMERID='"&CUSTOMER_ID&"' AND RMA_ID='"&rma_id&"'"
rs.open SQL, Conn2
If Not rs.BOF Then
%>
<tr>
<td><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&sort_by=status&tracknums_displayed=5&TypeOfInquiryNumber=T&loc=en_US&InquiryNumber1=<%=rs("ShipmentID")%>&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&AgreeToTermsAndConditions=yes&track.x=32&track.y=6">Track</a></td>
</tr>
<%
Else
Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
End If
If rs.EOF Then
RS.Close
End If
%>
/////////////////////////////////////////////////////////

Any help would be appreciated.

Thanks,
X-Centric

View 6 Replies View Related

Whats Wrong With This Query?

Aug 10, 2004

I am trying to sum a column together. This is what I am doing:

SELECT
sum(theoreticalTime= (Select
sum(rcp.theoreticalTime)

From
Traveler_X3 trv Join Recipe_X3 rcp On (trv.RecipeID = rcp.RecipeID)

Where
trv.Oper = rtsA.oper And
trv.RouteGroupID = (
Select
rgp.routeGroupID

From
Route_Group_X3 rgp

Where
rgp.routeGroupName = ( Select
rtl.RouteGroup

From
RouteList_X3 rtl

WHERE
rtl.route = rtsA.route
)
)
))


FROM
Routes_X3 rtsA

where
rtsA.route=( SELECT
lhm.route

FROM
brettb.pdash2.dbo.lothistorymoves lhm,
x3oprs x3o

WHERE
lhm.lot = 'S6D0IQ002A' AND
lhm.oper = x3o.oper AND
lhm.date_time = (SELECT max(date_time) FROM brettb.pdash2.dbo.lothistorymoves lhm, x3oprs x3o WHERE lhm.lot = 'S6D0IQ002A' AND lhm.oper = x3o.oper)
)

and rtsA.seq BETWEEN ( SELECT
seq

FROM
Routes_X3

WHERE
oper =( SELECT
lhm.oper

FROM
brettb.pdash2.dbo.lothistorymoves lhm

WHERE
lhm.lot ='S6D0IQ002A' AND
lhm.date_time = (SELECT max(date_time) FROM brettb.pdash2.dbo.lothistorymoves lhm WHERE lhm.lot = 'S6D0IQ002A')
)

and route=( select top 1
lhm.route

FROM
brettb.pdash2.dbo.lothistorymoves lhm,
x3oprs x3o

WHERE
lhm.lot = 'S6D0IQ002A' AND
lhm.oper = x3o.oper AND
lhm.date_time = (SELECT max(date_time) FROM brettb.pdash2.dbo.lothistorymoves lhm, x3oprs x3o WHERE lhm.lot ='S6D0IQ002A' AND lhm.oper = x3o.oper)
)
)+1 and 219;


What i got working was to put the query in a temp table called #temp1 and then run this:
select sum(theoreticalTime) from #temp1;

but isnt there a way to do this in one query?

Thank you for any help

View 1 Replies View Related

Whats Wrong With Cursors???

Oct 13, 2004

Hi, I recently modified all the messages with severity 15 and 16 to be logged in windows applications log... I then discovered that my Application is generating lots of errors of type:

Error: 16945, Severity: 16, State: 1
The cursor was not declared.

followed by

Error: 16955, Severity: 16, State: 2
Could not create an acceptable cursor.

I think this error is occuring since a lot, but I discovered it now because I recently modified which messages are logged (I added those with severity of 15 and 16).

This error is occuring everytime (one error every 3 minutes!!)... I dont know what part of my app is having trouble, i think its a bug of sql server... Does somebody know anything about this error?

Thanks!!

View 3 Replies View Related

Whats Wrong In This Query ?

Feb 14, 2007

DECLARE @Filter nvarchar(2048)
DECLARE @EventName nvarchar(2048)
DECLARE @Ticker nvarchar(2048)
DECLARE @Cusip nvarchar(2048)

SET @EventName = 'DIVIDEND'
SET @Ticker = 'IBM'
SET @Cusip = ''

SET @Filter = 'Name like ''' + @EventName + '%'' AND Ticker Like ''' + @Ticker + '%'' AND Cusip like ''' + @Cusip + '%'''

Select * from eventdatadetails
where @Filter

I want to execute the above SELECT statement and the filters in the where clause should come from the @Fitler variable... but query analyzer gives an error. If i replace the data in the @Filter with the variable in the query, everything works fine ...

View 4 Replies View Related

Whats Wrong With My Logic?

Mar 30, 2006

table1 = 500 rows
table2 = 1071560

table1.col1 = table2.col2 = 359
table1.col1 <> table2.col2 = 535779641 <---- instead it should return 141..

whats wrong? seems like it s table2 rows X table1 rows..

View 14 Replies View Related

Simple Q. Whats Wrong?

Oct 8, 2006

I'm very new to SQL.
YOur help is appreciated.
Ok system_user is the main table.
All the CREATED_BY and LAST_UPDATED_BY columns in all tables are supposed to reference back
to the system_user table.
Anything with _TYPE (i.e. CONTACT_TYPE, ADDRESS_TYPE ) is supposed to map to common_lookup
table.


Heres the error I get:
ERROR at line 12:
no mathiching unique or primary key for this column-list.

Heres where I I think I have the mistakes.
Pks and FKs


Thank you.


CREATE TABLE system_user
( SYSTEM_USER_ID NUMBER
, SYSTEM_USER_NAME VARCHAR2(20)
, SYSTEM_USER_GROUP_ID NUMBER
, SYSTEM_USER_TYPE NUMBER
, LAST_NAME VARCHAR2(20)
, FIRST_NAME VARCHAR2(20)
, MIDDLE_INITIAL VARCHAR2(1)
, CREATED_BY NUMBER CONSTRAINT nn_system_user_1 NOT NULL
, CREATION_DATE DATE
, LAST_UPDATED_BY NUMBER CONSTRAINT nn_system_user_2 NOT NULL
, LAST_UPDATE_DATE DATE
, CONSTRAINT pk_system_user_1 PRIMARY KEY (SYSTEM_USER_ID, CREATED_BY, LAST_UPDATED_BY));

CREATE TABLE common_lookup
( COMMON_LOOKUP_ID NUMBER
, COMMON_LOOKUP_CONTEXT VARCHAR2(30)
, COMMON_LOOKUP_TYPE VARCHAR2(30)
, COMMON_LOOKUP_MEANING VARCHAR2(30)
, CREATED_BY NUMBER CONSTRAINT common_lookup_1 NOT NULL
, CREATION_DATE DATE
, LAST_UPDATED_BY NUMBER CONSTRAINT common_lookup_2 NOT NULL
, LAST_UPDATE_DATE DATE
, CONSTRAINT pk_common_lookup_1 PRIMARY KEY (COMMON_LOOKUP_ID)
, CONSTRAINT fk_common_lookup_1 FOREIGN KEY (CREATED_BY)
REFERENCES system_user (CREATED_BY)
, CONSTRAINT fk_common_lookup_2 FOREIGN KEY (LAST_UPDATED_BY)
REFERENCES system_user (LAST_UPDATED_BY));


CREATE TABLE contact
( CONTACT_ID NUMBER
, MEMBER_ID NUMBER
, CONTACT_TYPE NUMBER CONSTRAINT nn_contact_1 NOT NULL
, LAST_NAME VARCHAR2(20)
, FIRST_NAME VARCHAR2(20)
, MIDDLE_INITIAL VARCHAR2(1)
, CREATED_BY NUMBER CONSTRAINT nn_contact_2 NOT NULL
, CREATION_DATE DATE
, LAST_UPDATED_BY NUMBER CONSTRAINT nn_contact_3 NOT NULL
, LAST_UPDATE_DATE DATE
, CONSTRAINT pk_contact_1 PRIMARY KEY (CONTACT_ID)
, CONSTRAINT fk_contact_1 FOREIGN KEY (CONTACT_TYPE)
REFERENCES common_lookup (COMMON_LOOKUP_ID)
, CONSTRAINT fk_contact_2 FOREIGN KEY (CREATED_BY)
REFERENCES system_user (CREATED_BY)
, CONSTRAINT fk_contact_3 FOREIGN KEY (LAST_UPDATED_BY)
REFERENCES system_user (LAST_UPDATED_BY));




CREATE TABLE address
( ADDRESS_ID NUMBER
, CONTACT_ID NUMBER CONSTRAINT nn_address_1 NOT NULL
, ADDRESS_TYPE NUMBER CONSTRAINT nn_address_2 NOT NULL
, CITY VARCHAR2(30)
, STATE_PROVINCE VARCHAR2(30)
, POSTAL_CODE VARCHAR2(20)
, CREATED_BY NUMBER CONSTRAINT nn_address_3 NOT NULL
, CREATION_DATE DATE
, LAST_UPDATED_BY NUMBER CONSTRAINT nn_address_4 NOT NULL
, LAST_UPDATE_DATE DATE
, CONSTRAINT pk_address_1 PRIMARY KEY (ADDRESS_ID)
, CONSTRAINT fk_address_1 FOREIGN KEY (CONTACT_ID)
REFERENCES contact (CONTACT_ID)
, CONSTRAINT fk_address_2 FOREIGN KEY (ADDRESS_TYPE)
REFERENCES system_user (COMMON_LOOKUP_ID)
, CONSTRAINT fk_address_3 FOREIGN KEY (CREATED_BY)
REFERENCES system_user (CREATED_BY);
, CONSTRAINT fk_address_4 FOREIGN KEY (LAST_UPDATED_BY)
REFERENCES system_user (LAST_UPDATED_BY));


CREATE TABLE telephone
( TELEPHONE_ID NUMBER
, CONTACT_ID NUMBER CONSTRAINT nn_telephone_1 NOT NULL
, ADDRESS_ID NUMBER CONSTRAINT nn_telephone_2 NOT NULL
, TELEPHONE_TYPE NUMBER CONSTRAINT nn_telephone_3 NOT NULL
, COUNTRY_CODE VARCHAR2(3)
, AREA_CODE VARCHAR2(6)
, TELEPHONE_NUMBER VARCHAR2(10)
, CREATED_BY NUMBER CONSTRAINT nn_telephone_4 NOT NULL
, CREATION_DATE DATE
, LAST_UPDATED_BY NUMBER CONSTRAINT nn_telephone_5 NOT NULL
, LAST_UPDATE_DATE DATE
, CONSTRAINT pk_telephone_1 PRIMARY KEY (TELEPHONE_ID)
, CONSTRAINT fk_telephone_1 FOREIGN KEY (CONTACT_ID)
REFERENCES contact (CONTACT_ID)
, CONSTRAINT fk_telephone_2 FOREIGN KEY (ADDRESS_ID)
REFERENCES address (ADDRESS_ID)
, CONSTRAINT fk_telephone_3 FOREIGN KEY (TELEPHONE_TYPE)
REFERENCES system_user (COMMON_LOOKUP_ID)
, CONSTRAINT fk_telephone_4 FOREIGN KEY (CREATED_BY)
REFERENCES system_user (CREATED_BY);
, CONSTRAINT fk_telephone_5 FOREIGN KEY (LAST_UPDATED_BY)
REFERENCES system_user (LAST_UPDATED_BY));

View 3 Replies View Related

Whats The Best Way To Copy A Database ?

Feb 13, 2007

I have a sql 2005 database on a server and I want to have a copy of that database on my workstation (running sql 2005 developer). What is the easiest way to do this ? We have DBGhost also.

View 20 Replies View Related

Whats Wrong With This Statement?

Jun 4, 2007

Query analyser is saying there is an error near the WHERE keyword:


INSERT INTO EMPLOYEE_TABLE (BANK_ACC, SORT_CODE)
VALUES (63035391,603030)
WHERE 40 IN (SELECT EMPLOY_REF FROM EMPLOYEE_TABLE);


Thanks people.

View 4 Replies View Related







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