|
Hi All,
I am using sql server
I have two tables with a same name in a same DataBase .this was created by two different DataBase users of that DataBase.I use ASP and get some values and insert the values to that table.
my doubt is which table will the data get inserted????????
please help me...............
If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
|
|
|
|
|
It depends on the which schema the login which you use(connection string from ASP) to connect to the database belongs to. If you're using "sa", it uses the "dbo" schema, by default.
SG
|
|
|
|
|
Thanks
If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
|
|
|
|
|
Hi All
consider Table
# tblTest
fldMainId fldSubID
1 A
1 B
1 C
2 A
2 B
3 A
Here I have written Query :
Select fldMainid from tblTest where fldSubID IN (A,B)
This gives Result fldMainId's : 1,2 and 3
How can I write query so that only fldMainid which has A,B strictly is choosen.So here 1 will not be choosen since it has C also, and 3 is not choosen since it has no A
Hence only 2 is choosen as it has A and B.
Navneet.H
Develop2Program & Program2Develop
|
|
|
|
|
In T-SQL you can use this query:
Select fldMainId from tblTest where fldSubID='A'
Intersect
Select fldMainId from tblTest where fldSubID='B'
Except
Select fldMainId from tblTest where fldSubID='C'
If you have more possibilities for fldSubID then either you will have to write longer query or use subquery
|
|
|
|
|
Hi GD,
Thank's a bunch , I will try it out and let you know.
thank's again
Develop2Program & Program2Develop
|
|
|
|
|
hi friends
Is Any server required to install the sqlserver2005?
regards
saravanan
|
|
|
|
|
saravanan05 wrote: Is Any server required to install the sqlserver2005?
Do you mean a server class operating system?
Express and Developer editions can run on XP and Vista. Standard and Enterprise editions need a server class operating system.
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
|
Hi,
I would like to export the result set from a query to excel file using sql statement. Would you please help me how to do it ?
Thanks in advance.
RB
|
|
|
|
|
|
|
How to create a script from a Stored Procedure in SQL Server 2005??
|
|
|
|
|
T4AMD wrote: How to create a script from a Stored Procedure in SQL Server 2005??
Right click the stored procedure in the Management Studio and click the appropriate create script button.
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
Here is what my data looks like this will be in comma delimited but it's exactly the data in the table:
RecordID, EventDate, EventTitle, EventCity
1, Nov. 1, Surgery Day, Boston
2, Nov. 1, Surgery Day, Atlanta
3, Nov. 3, Surgery Day, Asheville
4, Nov. 3, Surgery Day, Boston
5, Jun. 8, Surgery Day, Boston
6, Jun. 9, Surgery Day, Asheville
The problem I am having is that when I select events from the table I haven't a way to sort them in a proper monthly order. (Jan, Feb, March, Apr, May...) instead they sort alphabetically. Is there a way to structure the SQL so that it orders properly by month? How would I do that?
|
|
|
|
|
The 'EventDate' data must be of type date.
Then use an order by that converts to a formatted date truncated to the year and month. In Oracle I'd do it like so;
<br />
order by to_char(event_date,'YYYYMM')<br />
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
You need to create a datetime column and insert example: CAST('Nov 1 2007' as datetime) then order by that column
Dave Evans
|
|
|
|
|
I had experienced the same kind of problem in SQL Server 2000 too... do u mean that we need to insert a new datetime colum? I'm sorry I didnt quiet get what u said. can u plz give a more elaborate example on this.
thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
I would make the EventDate a datetime datatype (You may already be doing this but I couldn't tell). You can then SELECT * From [table] ORDER BY EventDate DESC
Dave Evans
|
|
|
|
|
No no that would just sort the data w.r.t date. What I want is to sort the data w.r.t the month and year, ignoring the day part.
My idea now is to do something like that in oracle
select col1, to_char(mydate,'Month, YYYY') AS Month
FROM Tab1
Order by to_char(mydate,'mm'),to_char(mydate,'YYYY')
but is this expression a valid one in Oracle
"Order by to_char(mydate,'mm'),to_char(mydate,'YYYY')"
and how should we do it in SQL Server 2000
and what if we need to group according to the months and year as well
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Same thing just use ORDER BY DATEPART(mm,mydate), DATEPART(yyyy,mydate)
Dave Evans
|
|
|
|
|
OK Thats gr8 thanksa bundle
Cheers...
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
I'm unable to open a recordset to an access 97 database. I can't even get an error to tell me why this is happening.
I have my connection object defined as follows
IMCDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\IMC\mdb\IMC.mdb;"
set session("IMCConn")=server.CreateObject("ADOdb.connection")
session("IMCConn").open IMCDSN
AnalysisDSN= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\IMC\mdb\Analysis.mdb;"
set session("AnalysisConn")=server.CreateObject("ADOdb.connection")
session("AnalysisConn").open AnalysisDSN
I then have some code that calls ClientAddEdit as follows:
sub ClientAddEdit()
'The first two lines creates the recordset and creates the beginning line
'of the SQL statement.
set rsClient = server.CreateObject ("adodb.recordset")
sqlClient = "Select * from [Client Table]"
sqlClient = sqlClient & " Where [ClientID] = " & varClientID
rsClient.open sqlClient, session("IMCConn"), adOpenDynamic, adLockPessimistic, adCmdText
'Modify the data in the database.
rsClient("ClientDescription") = request.form("txtClientDescription")
rsClient ("ClientContact") = request.form("txtClientContact")
rsClient ("ClientPhone") = request.form("txtPhone")
rsClient ("ClientComments") = request.form("txtClientComments")
rsClient.Update
rsClient.close
End sub
I tried putting error handlers but I cant even get the error to display. I tried "on error goto somelabel" as well as on error resume next and including logic as follows
if Err.number <> 0 then
msgbox Err.description
end if
immediately after the rsClient.open statement. I get nothing. I'm started to believe that I should upgrade the database to access 2000 for it work.
This code currently works in a windows nt box that i assume has access 97 installed. Could it be the version of access that may be possible causing the problem here?
Any experience anybody has had with this would be of great help.
Senior .Net Engineer @ Miami, FL
|
|
|
|
|
If using Access 97-format, use Jet 3.51. Access 2000 and later use Jet 4.0.
|
|
|
|
|
Then this must be an access 2000 database. However it may be, the code works in an NT workstation. However in my windows 2000 box, it doesn't seem to work.
I keep getting:
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.
Are there any special dll's that must be registered in order for ADO to properly work?
Anybody who's had any experience with getting ado recordsets to open against a conection with a state of 1 which indicates open. Please help.
Thanks.
Senior .Net Engineer @ Miami, FL
|
|
|
|