sql-server-2000

Export Image column from SQL Server 2000 using BCP

泪湿孤枕 提交于 2020-01-24 15:11:42
问题 I've been tasked with extracting some data from an SQL Server 2000 database into a flat format on disk. I've little SQL Server experience. There is a table which contains files stored in an "IMAGE" type column, together with an nvarchar column storing the filename. It looks like there are numerous types of files stored in the table: Word docs, XLS, TIF, txt, zip files, etc. I'm trying to extract just one row using BCP, doing something like this: bcp "select file from attachments where id =

In SQL Server 2000 how do you add 0's to beginning of number to fill nchar(n)

怎甘沉沦 提交于 2020-01-23 17:11:06
问题 I'm trying to add 0's to the beginning of an nchar(n) . Is their a format function in SQL Server 2000 to add 0's to an int so that it will always have n number of digits with leading 0's: example int nchar(n) 1 0000..1 2 0000002 3 0000003 ... 10 0000010 11 0000011 ... 100 0000100 ... 1000 0001000 回答1: e.g. for n=12 DECLARE @foo bigint DECLARE @bar bigint SET @foo=12345678901 SET @bar=12 SELECT RIGHT('000000000000' + CAST(@foo AS VARCHAR(12)),12) SELECT RIGHT('000000000000' + CAST(@bar AS

How can I determine the last time any record changed in a specific Sql Server 2000 database?

一世执手 提交于 2020-01-22 03:10:09
问题 I have a SQL Server 2000 database instance that is rarely updated. I also have a database table which has no columns holding each row's created date or modified date. Is there any way that I can determine the last time an update or insert was performed on the database as a whole, so that I can at least put a bound on when the specific records in the table may have changed? Note: I am looking for information about transactions that have already occurred. Triggers may help we should I require

How to split the date into monthwise

醉酒当歌 提交于 2020-01-21 19:19:11
问题 Using SQL Server 2000 I want to save the details in month wise User Entry ID = 001 Fromdate = 01/01/2012 Todate = 29/03/2012 ID = 002 Fromdate = 01/05/2012 Todate = 19/06/2012 ID = 003 Fromdate = 01/04/2012 Todate = 30/04/2012 ..... From the user entry, i want to insert the details in to table1 with the condition like fromdate and todate split in to monthwise (mm/yyyy) Expected Output ID period fromdate todate 001 01/2012 01/01/2012 31/01/2012 001 02/2012 01/02/2012 29/02/2012 001 03/2012 01

How can I query 'between' numeric data on a not numeric field?

怎甘沉沦 提交于 2020-01-21 11:06:30
问题 I've got a query that I've just found in the database that is failing causing a report to fall over. The basic gist of the query: Select * From table Where IsNull(myField, '') <> '' And IsNumeric(myField) = 1 And Convert(int, myField) Between @StartRange And @EndRange Now, myField doesn't contain numeric data in all the rows [it is of nvarchar type]... but this query was obviously designed such that it only cares about rows where the data in this field is numeric. The problem with this is

Sum Quantity and Price On Specific Condition

╄→гoц情女王★ 提交于 2020-01-17 06:59:19
问题 I am trying to do a sum of price and quantity in an excel file and store them in database table. So here it's (Trying by myself for learning) - Suppose, these are the excel file data: ProductId - Invoice No - Invoice Date - Price - Quantity 101 - Inv-1000 - 7/10/2017 10:00 - 1000 - 10 101 - Inv-1000 - 7/10/2017 10:30 - 200 - 2 101 - Inv-1000 - 7/10/2017 10:30 - 400 - 4 'These should be merged with the above one as they have the same invoice, product id and date time 102 - Inv-1000 - 7/10/2017

Sum Quantity and Price On Specific Condition

a 夏天 提交于 2020-01-17 06:59:07
问题 I am trying to do a sum of price and quantity in an excel file and store them in database table. So here it's (Trying by myself for learning) - Suppose, these are the excel file data: ProductId - Invoice No - Invoice Date - Price - Quantity 101 - Inv-1000 - 7/10/2017 10:00 - 1000 - 10 101 - Inv-1000 - 7/10/2017 10:30 - 200 - 2 101 - Inv-1000 - 7/10/2017 10:30 - 400 - 4 'These should be merged with the above one as they have the same invoice, product id and date time 102 - Inv-1000 - 7/10/2017

ASP - SQL injection protection in the SELECT clause

浪子不回头ぞ 提交于 2020-01-16 04:04:16
问题 After getting great help in securing against SQL injection from classic ASP protection against SQL injection, I've encountered a major issue which cannot be solved using parameterized queries. name = Trim(Request.QueryString("name")) flds = Trim(Request.QueryString("flds")) sql = "set rowcount 0 select " & flds & " from [TABLE] where Name = '" & name & "'" From what I understand, a parameterized query will protect against SQL injection in the WHERE clause (in this case, the name field. flds

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. TCP provider, error: 0

自作多情 提交于 2020-01-16 02:54:08
问题 I always get the above error when trying to connect to a SQL server 2000 database hosted on a "server" with Windows XP pro. The client pc (my working environment) is Windows 7. Up to now I have developed my application using Visual Studio 2010 and Net framework 4.0. All was working correctly. Then I have installed Visual Studio Express 2012 for Web and ASP.NET 4.5. Now, when i try to connect via SqlConnection conConnection .Open() i get the Exception: A connection was successfully established

Run long-running sproc (that doesn't need to return) from ASP.NET page

时间秒杀一切 提交于 2020-01-15 10:44:26
问题 I would like to know how you would run a stored procedure from a page and just "let it finish" even if the page is closed. It doesn't need to return any data. 回答1: A database-centric option would be: Create a table that will contain a list (or queue) of long-running jobs to be performed. Have the application add an entry to the queue if, when, and as desired. That's all it does; once logged and entered, no web session or state data need be maintained. Have a SQL Agent job configured to check