Help! Select Top 10 Does Not Work On Another SQL2000 Server...
Sep 6, 2001
I use 'select top 10 customerID, customerName from customers' on one
testing maching 'Test1', it works.
But after restore the database from 'Test1' to 'Test2', the same sql
select top statement does not work. Both machine are SQL2k.
appreciate your help!
-D
View 2 Replies
ADVERTISEMENT
Jan 24, 2008
Hi there,
i've tried using the SELECT SQL sentence on PPC with UNION and INNER JOIN in combination with DATEDIFF function which works fine on ordinary SQL but obviously does not work on compact edition. Is there some workaround?
SQL sentence that works:
Code Snippet
SELECT * FROM
(
SELECT 'O' Type, O.Name , OC.Name Contact, Birthday FROM OutletContact OC
INNER JOIN Outlet O ON OC.OutletID=O.OutletID
UNION
SELECT 'W' Type, W.Name,WC.Name Contact, Birthday FROM WholesalerContact WC
INNER JOIN Wholesaler W ON W.WholesalerID=WC.WholesalerID
) S
WHERE Birthday IS NOT NULL AND (DATEDIFF(day,GETDATE(),Birthday) BETWEEN 0 AND 14)
Thanks for any hint or solution to my problem,
Gorazd
View 1 Replies
View Related
Apr 29, 2008
Hello all,
I have two mult-value parameters in my report. Both of them working with selecting one or more values. But, when I test using "(Select All)" values for both parameters , only one parameter works. The "available values" for these two parameters are both from the data set.
select distinct ProductType
from Product
order by ProductType
Any suggestion? thx
View 12 Replies
View Related
Aug 15, 2006
Select *From HSRSeasonWHERESeasonID='1'HSRID=(Select HSRID FROM HSR WHERE HotelID='1' AND ServiceID='1' AND RoomID='1')
View 1 Replies
View Related
Sep 20, 2006
select uid, OrderID, Count(OrderID)As DupCnt
from OrdDetails
group by uid, OrderID
having count(OrderID) > 1
this returns no rows, can't I show another column to identify which uid goes with the dups, I did it before and now it doesn't work, probably something silly I'm missing.
thx,
Kat
View 9 Replies
View Related
May 15, 2006
I'm trying to programmatically create a new table that is a copy of another. The SQL statement I'm making is:
"SELECT * INTO sensor_stream_temp FROM sensor_stream"
and various combinations thereof (such as specifying the columns, etc)
The error I keep getting is:
There was an error parsing the query. [Token line number 1, Token line offset 10, , Token in error = INTO ]
Is it not possible to copy a table using this statement? *sigh*
Thanks in advance for any help.
-Dana
View 3 Replies
View Related
Aug 12, 2005
Bob writes "Your FAQ asks an intersting question:
Why doesn't SELECT @columns FROM @tablname work?
No answer is provided however.
I need to write a stored procedure the passes in a fieldname, retrives next key type int data from that field, increments the field, and returns the NextKey.
Would be nice if something like this worked:
DECLARE @iNext INT
SELECT @iNext = SELECT @columnName FROM Next_Keys WHERE ID = 1
SELECT @iNext = @iNext +1
UPDATE Next_Keys Set @columnName = @iNext WHERE ID = 1
RETURN @iNext
SQL Server 2000 - Win Server 2003
Editing SP from VS2005
TSQL newbe writing first sp"
View 1 Replies
View Related
Dec 13, 2007
Hello everybody
I have problem with CASE statement. Here is select it
Code Block
select
mev.Id
,mev.MetaElementId
,mev.ElementValue
,mev.DocumentId
,me.ElementTypeId
,castedValue =
case
when me.ElementTypeId =3 then cast(mev.ElementValue as integer)
when me.ElementTypeId =4 then cast(mev.ElementValue as datetime)
end
from dbo.tbMetaElementValue mev
inner join dbo.tbMetaElement me
on mev.MetaElementId = me.Id
where mev.MetaElementId =7
it returns
Id
MetaElementId
ElementValue
DocumentId
ElementTypeId
castedValue
49
7
2006
28
3
6/30/1905 0:00
53
7
2004
30
3
6/28/1905 0:00
61
7
2006
36
3
6/30/1905 0:00
67
7
2005
38
3
6/29/1905 0:00
70
7
2004
39
3
6/28/1905 0:00
105
7
2003
63
3
6/27/1905 0:00
166
7
2006
109
3
6/30/1905 0:00
195
7
2005
129
3
6/29/1905 0:00
220
7
2005
150
3
6/29/1905 0:00
223
7
2006
151
3
6/30/1905 0:00
As you can see it should return castedValue as integer but it cast to datetime which is wrong. If I commented line
Code Block
when me.ElementTypeId =4 then cast(mev.ElementValue as datetime)
it casts everything normal, but as soon as it has more than one condition in CASE it will choose anything but not right casting
Looks like I am missing something really fundamental. Any help is apreciated !
Thanks
View 8 Replies
View Related
Jan 31, 2008
My report runs from a stored proc, which gets the user to input a project id and a status. So the where statement in my stored proc looks like this:
Where (p.project LIKE @project_ID + '%' AND p.status IN(@Active))
On my report, I have set the @Active parameter to multi-value, and entered the available values(active and inactive). When I run the report, and only select one of the values, the report runs just fine, but when I use the "select all" option, I get no results at all.
I can't see where I am going wrong. Anyone got any ideas?
Thanks in advance!
View 4 Replies
View Related
Jul 5, 2007
hi there, i have a bit of a strange problem, and i must be doing something wrong because this works with insert and update statements in other pages. What is going on is that i am trying to do 2 select statements in the same bit of code so i dont have to open a datareader twice, but if i put the delivery charge select before the other it seems to get it, but if i put it after it does not, i just cant work it out! i have posted my code below for you all to have a look at because im stumped!
//gets order id and customer id and puts them to strings and int to be used laterstring strCustID = Request.QueryString["qsnOrderCustID"].ToString();
int intCustID = Convert.ToInt32(strCustID);string strOrderID = Request.QueryString["orderID"].ToString();int intOrderID = Convert.ToInt32(strOrderID);
//This is the sql statement.string sql = "SELECT [sub_total], [VAT], [Total] FROM tbl_order WHERE order_ID = " + intOrderID + ";" + "SELECT [del_cost] FROM tbl_del WHERE order_ID = " + intOrderID;
//This creates a sql command which executes the sql statement.SqlCommand sqlCmd = new SqlCommand(sql, myConn);
myConn.Open();SqlDataReader dr = sqlCmd.ExecuteReader();
//This reads the first result from the sqlReader
dr.Read();
//This sets the title label text to the value of the description column.
try
{
//fill these labels with the first select statement lblSubTot.Text = dr["sub_total"].ToString();
lblVAT.Text = dr["VAT"].ToString();lblOrderTotal.Text = dr["Total"].ToString();lblDelCharge.Text = dr["del_cost"].ToString();
//fill this label with the second select statementlblDelCharge.Text = dr["del_cost"].ToString();
}catch (Exception except)
{string strError = Convert.ToString(except);
}
finally
{
myConn.Close();
}
any ideas would be great! thanks
Jez
View 2 Replies
View Related
Sep 21, 2001
I administer several servers. My login is a SysAdmin on all servers with not only the same Name and Password, but also the same SID. In setting up Linked Servers, I can successfully SELECT data from a server other than the host server, but if I try to SELECT * INTO I get the following error:
The object name 'DB1.ogSerial.dbo.' contains more than the maximum number of prefixes. The maximum is 2.
Here are the queries I've tried (using DB3 as the host, DB1 as the linked server).
SELECT * INTO DB1.MyDB.dbo.TestTableNew FROM DB3.MyDB.dbo.TestTable
SELECT * INTO DB1.MyDB.dbo.TestTableNew FROM DB1.MyDB.dbo.TestTable
SELECT * INTO DB1.MyDB.dbo.TestTableNew FROM MyDB.dbo.TestTable
View 3 Replies
View Related
Mar 11, 2008
Code:
exec('select RIGHT(00000 + CAST(dh.zipcode AS varchar(5)), 5) as zip, '+@fieldname +' as distance into #distance from sumplicity.dbo.t_distancetohospital dh')
This runs normally and returns the number of rows created. Yet when I do a 'select * from #distance' query, I get a message that #distance doesn't exist.
Where is it storing all of this and how do I access it?
View 1 Replies
View Related
Jan 26, 2006
I am writing some functions that work on a time series database of prices, ie volatility, correlation. I need to use the SELECT TOP syntax, but cannot do this with a variable, ie 'SELECT @x TOP * from prices'. My solution is to simply have a function for each potential period that will be looked at - 30day_volatility, 60day_volatility, etc. I looked at setting the ROWCOUNT variable but this is not allowed in functions. I haven't posted any DDL because I think the question is general enough - How do I return n ordered rows from a function without using SELECT TOP, or is there a way to use SELECT TOP with a variable that I am not aware of.
Thanks!
View 2 Replies
View Related
Jun 10, 2015
Consider the below script
CREATE TABLE #TEMP(Id int,CreatedBy varchar(30),ModfiedBy varchar(30))
CREATE TABLE #TEMP2 (ID int,SearchedBy varchar(30))
INSERT INTO #TEMP VALUES(1,'James',NULL)
INSERT INTO #TEMP VALUES(1,'James','George')
INSERT INTO #TEMP VALUES(1,'James','Vikas')
INSERT INTO #TEMP2(ID) VALUES(1)
INSERT INTO #TEMP2(ID) VALUES(1)
INSERT INTO #TEMP2(ID) VALUES(1)
Now i want to get the result as
;WITH CTE AS(
SELECT ROW_NUMBER() OVER(PARTITION BY Id ORDER BY ID ASC) AS RowNum ,*
FROM #TEMP
)
SELECT CASE WHEN RowNum=1 THEN CREATEDBY
WHEN RowNum > 1 THEN ModfiedBy
END
FROM CTE
But when i convert this select to update, i am missing something...
My update is
;WITH CTE AS(
SELECT ROW_NUMBER() OVER(PARTITION BY Id ORDER BY ID ASC) AS RowNum ,*
FROM #TEMP
)
UPDATE #TEMP2
SET SearchedBy =CASEWHEN RowNum=1 THEN CREATEDBY
WHEN RowNum > 1 THEN ModfiedBy
END
FROM CTE
WHERE #TEMP2.ID=CTE.ID
Only the first record gets updated...
View 9 Replies
View Related
Jun 4, 2007
Hello to all,
i have a problem with IN-Operator. I cann't resolve it. I hope that somebody can help me.
I have a IN_Operator sql query like this, this sql query can work. it means that i can get a result 3418:
declare @IDM int;
declare @IDO varchar(8000);
set @IDM = 3418;
set @IDO = '3430'
select *
from wtcomValidRelationships as A
where (A.IDMember = @IDM) and ( @IDO in (3428 , 3430 , 3436 , 3452 , 3460 , 3472 , 3437 , 3422 , 3468 , 3470 , 3451 , 3623 , 3475 , 3595 , 3709 , 3723 , 3594 , 3864 , 3453 , 4080 ))
but these numbers (3428 , 3430 , 3436 , 3452 , 3460 , 3472 , 3437 , 3422 , 3468 , 3470 , 3451 , 3623 , 3475 , 3595 , 3709 , 3723 , 3594 , 3864 , 3453 , 4080 ) come from a select-statement. so if i use select-statement in this query, i get nothing back. this query like this one:select *
from wtcomValidRelationships as A
where (A.IDMember = @IDM) and ( @IDO in (select B.RelationshipIDs from wtcomValidRelationships as B where B.IDMember = @IDM))
I have checked that man can use IN-Operator with select-statement. I don't know why it doesn't work with me. Could somebody help me? Thanks
I use MS SQL 2005 Server Management Stadio Express
Thanks a million and Best regards
Sha
View 2 Replies
View Related
Sep 17, 2006
i have sql2000 & sql2005 on the same machine. I am unable to register my localhost in sql2000, get an access denied error. How can I make my localhost use sql2000 database?
View 1 Replies
View Related
Oct 12, 2006
Hi,I was hoping someone may be able to shed some light on a SQL2000 connection problem.I have an ASP.NET(1.1) application that connects to a SQL2000 instance on the localmachine, the connection details are as follows: Connection Code :try
{//connect to the provided datasource
using(SqlConnection connection = new SqlConnection(strConnectionInfo))
{
strStatus = "Pulling Data";
SqlDataAdapter sqlA = new SqlDataAdapter("SELECT * FROM NavBlocks",connection);
sqlA.Fill(dsNav.NavBlocks);
SqlDataAdapter sqlB = new SqlDataAdapter("SELECT * FROM NavItems",connection);
sqlB.Fill(dsNav.NavItems);
bNavLoaded = true;//prevent further calls
}
}The connection string is as follows: "Data Source=BOBBITSQL2000;Initial Catalog=pinnacleCMS;User Id=myUser;Password=myPass;"Now this conection has never been a problem, the intial catalog exists, the user exists and has permissions, further to this this users connection details can be used to succesfully access the database from a dsn on this machine. The server explorer finds the database fine, Visio finds the databse fine.The problem only existed after I reverse engineered the database into visio (the database was originally developed using Visio), then dropped all of the tables using Enterprise Manager, and re generated the database from within Visio (ddl script) following a few minor changes.Since the re generation I get the server not found error message from the ASP.Net application.I have tried using different network libraries, logging in using the sa account etc, it makes no difference the ASP.Net application cannot see the SQL server instance.Any ideas would be greatly appreciated.p.s. I have tried dropping the firewall with no success, no updates have been installed.Thanks
View 7 Replies
View Related
Feb 13, 2007
I recently was moved into an applications developers position here at the lawfirm I work at.
Thusfar, its been alot of straight ASP, SQL2000, and Access.
I know the need for me to know .Net is coming, and Ive decided to start playing with ASP.net so I can look a bit proactive..
Ive looked over what I need to get started, in liu of Visual Studio I know of the VS Express options. However, I currently have SQL Server 2000 installed locally on my machine along with IIS 5.1. All the VS Express information Ive found keeps referencing SQL2005 express. Can I get away with using what I already have with 2000? Or if not, can SQL2005 express be run alongside with SQL2000?
Any assistance would be greatly appreciated.
Brian
View 2 Replies
View Related
May 24, 2008
SQL Server 2005 is better than SQL2000 ..How??..Which feature is available in SQL2005 but not in SQL2000???
View 2 Replies
View Related
Nov 14, 2002
Hi,
I'am running Sql2000 Enterprise edition
on Windows 2000
When I re-name the Server for example
from TST_SVR To TST_SVR1, Sqlserver comes backup fine with the new name (TST_SVR1) , BUT I'am still able to connect to the SqlServer even with the old Server name (TSR_SVR). I do not want to connect using the old server name.
I have dropped and added server using
Sp_addserver and Sp_Dropserver, My
@@servername command returns the new server name
Any help in this matter is really appreciated
Thanks
Sanjeev
View 2 Replies
View Related
Feb 16, 2005
Brand new to linked servers and trying some stuff. I've successfully linked a server using EM (both are sql2000). I can successfully run a select statement through QA. I'm trying to test a locally-stored procedure and am having a bit of trouble. Please, no arguements about best method - I have no choice. Cannot create stored procs on remote machine.
If I run this through QA, I get an immediate return set: select * from linkedName.dbName.dbo.tblName
If I try to create a test stored proc like the following, I get: Error 7405: Heterogeneous queries require the ANSI_Nulls and ANSI_WARNINGS options to be set for the connection. This ensure consistent query semantics. Enable these options and thenreissue your query. When I looked it up in BOL, I thought I was setting these items?
CREATE PROCEDURE zp_countyListing AS
SET ANSI_WARNINGS ON
SET ANSI_NULLS ON
select * from linkedName.db.dbo.tblName
Thanks for the assistance.
View 1 Replies
View Related
Jan 16, 2004
I have Windows server 2003 installed, and Visual Studio .NET 2003 ent.arch also. I downloaded the msde sp3 from microsoft's site. installed it. The problem occured when i rebooted my machine. The system tray icon of SQL Server Service Manager says "Not connected". When i open the manager, there are no Services nither Servers listed in the dropdown lists. Can you help with this. Thx in advance!
View 2 Replies
View Related
Mar 9, 2004
I’ve got a linked server created in SQL2000 to DB2.
I’m using Client Access ODBC Drivers, and Microsoft OLE DB provider for ODBC Drivers.
I have views created against the linked server as
ALTER VIEW BLBATDT AS
SELECT * FROM LURCH_PARADB.S102D4LM.PARADB.BLBATDT
All seem(ED) to be working fine until I ran into this issue.
Using the view
If I select count(*) from BLBATDT returned value 786
If I select * from BLBATDT I get 76 rows returned
If I select from BLBATDT where field = value I get nothing, when in fact there is a value I specified.
I modified the view creation to
Create view as
select * from openquery(LURCH_PARADB,
'select *
from S102D4LM.PARADB.BLHDR')
Performed the above simple selects, (same results)
I modified the view creation to
Create view as
select * from openquery(LURCH_PARADB,
'select field_list_of_all_fields_in_the_table
from S102D4LM.PARADB.BLHDR')
Same results
However if I modified the view creation to
Create view as
select * from openquery(LURCH_PARADB,
'select field1, field2
from S102D4LM.PARADB.BLHDR')
And limit the fields selected to a small subset, everything works fine.
I think the issue may be that the parent tables are very wide in total byte count and the number of fields is also large.
This particular tables has 120 fields with a total record length of over a 1000 bytes.
If this is the case, how do I resolve this?
Has anyone ran into this before?
View 7 Replies
View Related
Jul 20, 2005
hello,I'm trying to create a linked server from an SQL2000 to a Unify ELS(very old, odbc is version 1) database on SCO unix.The odbc driver is old but it works fine when used by applications forcreating reports.What I want to do is make a linked server from the SCO box to the win2kbox. So, I'm using enterprise manager to create the linked server.The DSN of the unify database is CORE_OFFICE1I'm getting 'Error 7399: OLE DB provider 'MSDASQL' reported an error.Datasource name not found and no default driver specified.When I create the linked server I chose the OLE DB for ODBC drivers.I put 'CORE_OFFICE1' for the Data Source name. I also setup thesecurity with the name of a unix account for login/password.What else should I have?I'm new at this linked server stuff!Product Name:Data Source:Provider String:Location:Catalog:Thanks,Oskar
View 4 Replies
View Related
Apr 3, 2007
Our SQL Developer asked for a new server with a separate small hard disk for the Transaction Log alone to reside on, to increase performance. This will be hard to do, since the servers we have been looking at are low-profile rackmount, and only hold 2 SATA disks. I hate to waste our only expansion bay on a small HD. Is this really something important, or will a Quad-core processor and plenty of RAM make the performance difference negligible? We have 32-bit SQL2000 licensed per processor, and our database is only about 26GB. I was hoping to get 1 large disk and partition it into a 20GB OS partition, and the rest would be for SQL. Am I totally on the wrong track?
My 2nd question is about RAM - if we get 4GB of RAM, will it decrease the performance if we get 64-bit O/S pre-installed instead of 32-bit? I know 64-bit O/S *can use* more RAM than 4GB, but does it *need* more RAM for the same level of performance that we have now? (We are planning to expand that to at least 8-12GB whenever we upgrade to 64-bit SQL2005, but the budget does not allow it just yet.)
Thanks!
View 3 Replies
View Related
Sep 13, 2006
Hi,
I want to install SQL 2000 Server on Win-2003 STD Server and transfer the database that has been running on SQL-2000/Win 2K server.
Win-2003 Server has Apache services and TrendMicro AV Server running. After installation the SQL service starts automatically. But I am not able to see the database from Enterprise manager. It gives error 'A connection could not be established to <local>. Reason: Login failed for DOMAIN/USER. I am logged into Win2003 server as 'Administrator' for installation. SQL Server authentication in Mixed Mode and connect using Domain user account.
While applying update(SP3) also the same error comes after trying to validate password and the Sql service automatically stops. I tried using both Win pwd and SQL sa pwd. Both are giving same error.
How I can go abt it?
Shall be grateful for a reply,
View 5 Replies
View Related
Nov 3, 2006
I can restore databases one by one, setting .mdf and .ldf destination paths.
How can I restore all my Databases at the same time?
Thanks
G. Zanghi
View 7 Replies
View Related
Jan 7, 2007
Linked server from SQL2005 to SQL2000
Hi
I use the following SQL statements to create a link server. RemoteServerName is an SQL2000 and I am executing this in another machine which is SQL2005.
Though the link server is created successfully, I am not able to se the tables under it so could not query anything.
----
USE [master]
EXEC master.dbo.sp_addlinkedserver @server = N'RemoteServerNameInstanceName', @srvproduct=N'SQL Server'
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'collation compatible', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'data access', @optvalue=N'true'
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'rpc',@optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'rpc out', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'connect timeout', @optvalue=N'0'
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'collation name', @optvalue=null
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'query timeout', @optvalue=N'0'
EXEC master.dbo.sp_serveroption @server=N'RemoteServerNameInstanceName', @optname=N'use remote collation', @optvalue=N'true'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'RemoteServerNameInstanceName', @locallogin = NULL , @useself = N'False', @rmtuser = N'remoteUser', @rmtpassword = N'remotePassword'
View 5 Replies
View Related
Nov 13, 2000
I have setup SQL2000 Personal edition on my notebook.
I cannot connect to an existing SQL7 server on the network anymore. I
used to run SQL7 Desktop edition which ran just fine.
I also noticed that when I start my machine it take about 2 minutes
until the SQL service is started.
Any ideas why this is not working anymore?
Thomas Schoch
Elephant Software AG
Switzerland
View 1 Replies
View Related
Oct 24, 2002
Anyone know where I can find some documentation on how to set up a 2 node cluster? Thanks
View 5 Replies
View Related
Jan 17, 2002
Hi
What connection string should i use to connect to a remote SQL2000 server over the internet??
Thanks
View 2 Replies
View Related
Jan 2, 2007
Hi,
I'd like to host a small website created using VS2005 EE with a company that offers just SQL2000 DB support.
My question, can i use the DB created by VS site manager as a DB to the site, if not, is there any alternatives.
Thanks.
View 1 Replies
View Related
Jul 20, 2005
How to restore a database dump file (.BAK) that backed up from SQL2000 server to a SQL 7.0 server?Please help.Saiyou
View 1 Replies
View Related