sql-server-2000

java to sql server connectivity exception

荒凉一梦 提交于 2019-12-02 08:55:50
I have this error/exception- SQL Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "connect timed out. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.". and my code is- try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String connectionUrl = "jdbc:sqlserver://localhost:1433"; Connection con = DriverManager.getConnection(connectionUrl,"","");

OK for this to be a SQL Server job?

妖精的绣舞 提交于 2019-12-02 08:06:34
问题 I have a folder that contains images for use badges. I have another folder that contains renamed versions of the images (this folder is on another machine). I need to create a process that will copy and rename any new images found. The mapping between the names is in a SQL Server DB. Would it be a bad idea to create this as a SQL Server job and use xp_cmdshell to copy the files? This was my first instinct, but I haven't done this before so I was curious if there were any gottchas i should

Cannot connect to SQL SERVER 2000

心不动则不痛 提交于 2019-12-02 07:46:09
I am using php 5.3.1 to connect to my SQL SERVER 2000 on remote machine. I use Windows XP. On using simple program like this: $conn = mssql_connect("VBNET","sa","mypass") or die ( 'Can not connect to server' ); I get following error: Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in C:\wamp\www\Mssql\test.php on line 8 Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: VBNET in C:\wamp\www\Mssql\test.php on line 8 Can not connect to server I enabled

Value should be 0 between the two dates?

强颜欢笑 提交于 2019-12-02 07:38:35
Using SQL Server 2000 I want to compare the table2.date between table1.from, table1.todate, if exist then value should be 0 (zero) Table1 ID FromDate ToDate 001 20090801 20090815 002 20090817 20090820 …, Table2 Id Date Value 001 20090730 100 001 20090731 200 001 20090801 300 001 20090802 400 … 001 20090815 0 001 20090816 250 … From the above two table I want to ID, Date, value from table2 where table2.date between table1.fromdate and table1.todate then table2.value =0 Expected Output Id Date Value 001 20090730 100 001 20090731 200 001 20090801 0 001 20090802 0 … 001 20090815 0 001 20090816 250

OK for this to be a SQL Server job?

百般思念 提交于 2019-12-02 06:46:19
I have a folder that contains images for use badges. I have another folder that contains renamed versions of the images (this folder is on another machine). I need to create a process that will copy and rename any new images found. The mapping between the names is in a SQL Server DB. Would it be a bad idea to create this as a SQL Server job and use xp_cmdshell to copy the files? This was my first instinct, but I haven't done this before so I was curious if there were any gottchas i should know about... Considering most simple questions on SO are answered in seconds , and you asked this one 53

SQL Server 2000 Integer truncating

限于喜欢 提交于 2019-12-02 06:36:04
问题 Plain and simple, does anybody know why this: Select 30 * 220 / 30 Returns 220 , which is the correct result, and this: Select 30 * (220/30) Returns 210 ??? On the second case, I realise that 220/30 is being calculated first, generating a decimal (7,333333...) but still... isn't this lousy precision? 回答1: Under integer division 220/30 = 7 and 99/100 = 0 (note truncation not rounding) Use non integers to avoid this. e.g. Select 30 * (220/30.0) Or you can use an explicit cast Select 30 * (220

How to work around SQL Server's “The maximum number of tables in a query (260) was exceeded.”

我的未来我决定 提交于 2019-12-02 06:27:47
问题 i have a query that contains a series of 21 UNIONs , e.g.: CREATE VIEW dbo.USGovCurrencyOnHandBreakdown AS SELECT ... FROM a UNION ALL SELECT ... FROM b UNION ALL SELECT ... FROM c UNION ALL SELECT ... FROM d ... UNION ALL SELECT ... FROM u The query runs fine when run alone. But when the query is run through the containing view: SELECT * FROM USGovCurrencyOnHandBreakdown Msg 4414, Level 16, State 1, Line 1 Could not allocate ancillary table for view or function resolution. The maximum number

Query to Return Top Items for Each Distinct Column Value

烈酒焚心 提交于 2019-12-02 04:58:42
If I have a table with the following fields ID, SomeFK, SomeTime How would I write a query return the latest/top 3 items (based on SomeTime ) for each SomeFK . So, the result might look like SomeFK Sometime 0 2012-07-05 0 2012-07-04 0 2012-07-03 1 2012-07-03 1 2012-07-02 1 2012-07-01 2 2012-07-03 2 2012-07-02 2 2012-07-01 ....etc.... Returning the latest items for a particular SomeFK is easy, but i just can't think how to do it for the above. I also feel it should be dead simple! EDIT: Apologies, I missed a key bit of information. this is for SQL2000, so ROW_NUMBER() can't be used! SELECT

SQL Server 2000 Integer truncating

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 04:28:23
Plain and simple, does anybody know why this: Select 30 * 220 / 30 Returns 220 , which is the correct result, and this: Select 30 * (220/30) Returns 210 ??? On the second case, I realise that 220/30 is being calculated first, generating a decimal (7,333333...) but still... isn't this lousy precision? Under integer division 220/30 = 7 and 99/100 = 0 (note truncation not rounding) Use non integers to avoid this. e.g. Select 30 * (220/30.0) Or you can use an explicit cast Select 30 * (220/cast (30 as float)) The one in the parentheses, is always evaluated first, but since the machine logic you

T-SQL Query Returning Items It Shouldn't Be

[亡魂溺海] 提交于 2019-12-02 02:41:38
问题 Here's the scenario. The column in question is called 'datein' and it's type is 'datetime'. I have three rows with the value of '2009-10-01 00:00:00.000' for 'datein'. Why does this query return the aforementioned rows? SELECT * FROM t_call AS tc WHERE tc.datein >= '2009-09-30 00:00:00.000' AND tc.datein <= '2009-09-30 23:59:59.999' Using SELECT * FROM t_call AS tc WHERE tc.datein BETWEEN '2009-09-30 00:00:00.000' AND '2009-09-30 23:59:59.999' returns the same result 回答1: It's the lack of