Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008
all groups > sql server programming > september 2007 > threads for monday september 17

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

How to import data from file via T-SQL
Posted by huohaodian NO[at]SPAM gmail.com at 9/17/2007 7:50:31 PM
I am trying to import data from a file with below format, each column is located fixed position ( id start at 1 end at 10, name start at 11 end at 40 ) 100348Boothroyd,Green 9080598300 40 WEEK RESTRICT 100348Boothroyd,Green 9080598300 40 WEEK ACC...more >>


inserting multiple identities at once
Posted by JRStern at 9/17/2007 6:38:03 PM
OK, what's best practice for this? I have a doc_header table with an identity PK, and a doc_line table that uses the doc_header plus line_nbr for its PK. I want to do insert several rows at once to the header, and then get the identities to use for the lines. If it were a singleton, I'd j...more >>

SSIS Transfer SQL Server Objects Task not working with Stored Procedures
Posted by at 9/17/2007 5:48:52 PM
I'm unable to copy my Stored Procedures from one database to another. I'm using mixed mode authentication. I have set CopyAllStoredProcedures to True, DropObjectsFirst to True and CopySchema to True. Nothing gets copied. I have followed many web sites that say Transfer SQL Server Ob...more >>

Rounding issue
Posted by Faye at 9/17/2007 5:44:33 PM
I am still using sql 2000. This formula, 1492/108 = 13.814... When I use Round function around it, I expect the result to be 14. Why is it coming out as 13? SELECT ROUND(1492/108, 0); Can someone explain what I missed? Thanks. Faye ...more >>

If CAST fails then NULL
Posted by garey.taylor NO[at]SPAM gmail.com at 9/17/2007 5:33:10 PM
I'm trying to convert a string to a datetime using the cast function but I get an out of range error. birth_dt = '19000000' select cast( substring(birth_dt, 5,2) + '-' + substring(birth_dt, 7,2) + '-' + substring(birth_dt, 0,5) as DateTime) as birth_date from table ERROR: Caused by...more >>

Help with SUM and GROUP by
Posted by DG at 9/17/2007 5:02:53 PM
I am using excel 2k3 to access MS SQL server. I am trying to total qty_shipped for each item with the following statement: SELECT sales_history_view.item_id, view_supplier.supplier_name, Sum(p21_sales_history_view.qty_shipped) AS 'Total Shipped' FROM CC.dbo.sales_history_view sales_histor...more >>

Enbedding a curser loop within a curser loop
Posted by Alex at 9/17/2007 3:52:55 PM
Hello, I'm trying to embed a curser while-loop within another curser while-loop, but with both using "WHILE 0 = @@FETCH_STATUS" the internal loop is causing the external loop to exit too early. Is there anyway to use something other then @@FETCH_STATUS or someway to tell this variable whic...more >>

query by month only
Posted by bcap at 9/17/2007 1:47:08 PM
Hello! I need to do a report and pull all birthdays in October for our customers. How can I pull this information just using October ( "10") part of a date field? Thank you for any time and thought! Ray ...more >>



Need to add a new row..Help
Posted by amj1020 at 9/17/2007 1:43:34 PM
Say I have four fields: Symbol, Expiration date, Vaule1, value2 If the current date is one month before the expiration date I want to add a new row, where the symbol will be different and all other fields are the same. So in my table I have: PDS,2007-10-17, 234,24 Since the expiration dat...more >>

Brain Phart
Posted by Brad Ashforth at 9/17/2007 1:42:01 PM
I am trying to process some records conditionally in a cursor (SQL2000). The SP is below. I always seem to have issues with IF :( When I execute the code below (trying to create the SP, via Query Analyzer) I get:Server: Msg 170, Level 15, State 1, Procedure TRMaintenance_Daily, Line 23 Li...more >>

Update from a date-effective table
Posted by Pierre at 9/17/2007 1:29:45 PM
Hi, I need to update a table in server A from a date-effective table in server B. In table A, it has account, description, and status; and in table B, it has account, effective date, and statusB. The unqiue key in table A is account, and unique key in table B is account and effective date. Fo...more >>

problem linking opends60.lib into a 64 bit dll project.
Posted by Mark Haskin at 9/17/2007 12:32:07 PM
I am trying to recompile a legacy 32 bit extended stored procedure into 64 bits for use on 64 bit SQL 2005. I have downloaded the Microsoft Platform SDK for Windows Server 2003 R2 with the 64 bit binaries and libraries and I have the opends60.lib file that gets installed with SQL2005 64bit...more >>

Total row count when paging
Posted by Ben Amada at 9/17/2007 12:16:26 PM
Hi. I'm using SQL 2005 to page results for a web application. There will be 10 rows per results page. I'm using a CTE and the row_number() function. On the web page, I want to also show page numbers that can be navigated to and probably the total count. To get the total row count, I see th...more >>

DataSet Usage
Posted by Tom Woods at 9/17/2007 12:15:51 PM
I've been struggling with the best way to use a DataSet, Bindings and Adapters in the application I'm laying out. To start, I'm new with DataSet's and MS SQL. I'll start by describing what my goals are: I have a form that will have a list (grid) of items from Orders. This list will be do...more >>

maintanance plan
Posted by bb at 9/17/2007 11:00:08 AM
I dont know is this the correct forum to ask this question. I am creating a maintanace plan for rebuilding an index. The table is having 7 non clustered indexes. Out of that only one index is getting fragmented a lot. I want to create a maintanance plan to rebuild that particular index. I have...more >>

INSERT then UPDATE
Posted by CLM at 9/17/2007 10:52:04 AM
Let's say that you have two statements in SS 2000 stored proc. The first is an INSERT statement that inserts 500,000 rows into a table and the second is an UPDATE statement that updates some of those 500,000 rows. And let's say that 499,000 rows get inserted but then something bad happens an...more >>

Rotate Data in Log File
Posted by Alex at 9/17/2007 10:00:26 AM
Hello, I'm trying to parse a log file, but I'm not sure the best way to get the output the way I need. Here's a snippet of the log: FileName MD5CheckSum Date test.txt 123123123 2007-01-02 test2.txt 443223432 2007-...more >>

Double Indexing
Posted by CLM at 9/17/2007 9:54:07 AM
I'm working at a new place and I found this on a table (SS 2000 SP4) after running sp_helpindex. One of the DBA's here claims that one time he had a similar situation on another table and removing the index, the equivalent of idx_nn_tbl_OS2007Q2_CDate in this case, hurt performance. How ...more >>

COUNTS IN TABLE'S PROPERTY ARE DIFFERENT FROM QUERY COUNT(*)
Posted by weileogao NO[at]SPAM gmail.com at 9/17/2007 8:30:35 AM
I have a table which inclues around 64,000 records. When I use table's property to check its counts it always shows the wrong records less than the real records. I try to refresh the table, but it does not work. Does someone have same experience? ...more >>

Space Error
Posted by FARRUKH at 9/17/2007 8:28:14 AM
I got an error this morning when my optimization job run 'Could not allocate space for object '(SYSTEM table id: -637536758)' in database 'DB' because the 'PRIMARY' filegroup is full.' For the data file settings : * Space allocated for data : 3335 MB (PRIMARY) * Auto grow file is set, 10%...more >>

Multiple Agregated columns in same SQL
Posted by JF at 9/17/2007 8:03:29 AM
Hi I have this table (XTable) A B C D 1 2 3 "X" 1 2 3 "Y" 1 2 3 "X" 1 1 3 "X" 1 1 3 "Y" I want to calculate the number of times the A,B,C is X and Y like a report: A B C XTimes YTimes 1 2 3 2 1 1 1 3 1 1 I could us...more >>

Keeping history of DB structure modification in SQL 2005
Posted by checcouno at 9/17/2007 8:00:00 AM
Is it possible to keep an hisotry of my DB modification (not data only structure schema) in SQL 2005. For example if i ALTER a procedure, can i have trace of this modification, can i go back to previous versione of my proc? Thanks...more >>

Job that runs twice when it should only run once
Posted by Chris at 9/17/2007 7:02:02 AM
I have an instance of SQL Server 2005. I have a job in this server that runs twice when it should only run once. In the job history log the duplicate always has a negative duration run time. for Example -3976.20:35:40 Is there a fix or work around for this? I have other jobs on this server...more >>

Cannot make more than one query on a complex CTE
Posted by mark4asp at 9/17/2007 5:44:31 AM
I cannot make more than one query on a complex CTE I am trying to run a query with quite a complex CTE query (using CROSS JOINs and several CASE statements in the WHERE clause) After the CTE has been made there are 3 queries (SELECT statements) because I want this to return 3 distinct tables...more >>

In and EXISTS Under the hood?
Posted by Bob at 9/17/2007 5:18:02 AM
Can anyone tell me how In and EXISTS work under the hood? ie are hash tables or binary checksums involved ? Thanks...more >>

datediff problem
Posted by pedro.j.manuel NO[at]SPAM gmail.com at 9/17/2007 5:09:22 AM
idDocumento DataEntrega days ----------- ----------------------- ---- 80002281 2006-11-06 00:00:00 80002280 2006-11-04 00:00:00 80002279 2006-10-06 00:00:00 80002278 2006-09-06 00:00:00 80002272 2006-09-01 00:00:00 Hi, I have this table with this records, and ...more >>

Inserting jpg images into a table
Posted by Ant at 9/17/2007 3:36:05 AM
Hi, Is there a way using only a query in say, query analyzer, to add images to a table? Thanks very much in advance for any answers Ant...more >>

Order by
Posted by sk NO[at]SPAM email.si at 9/17/2007 2:54:44 AM
Hello everybody, I have the following question. Let's say that I have the following values in my column (text column, 15 characters long) and If I order the alfabetically, I get the following result: 6A001 6A0010 6A00100 6A002 6A0021 6A0022 6A003 6A004 Is there a way to order them ...more >>

EBCDIC 870 Import from AS400 ?
Posted by Martin Knauer at 9/17/2007 12:10:03 AM
Hi, is there a collation for EBCDIC 870 for importing into SQL-Server? I'm currently trying to import hungarian Characters from an AS400 (stored as Codepage 870) to SQL-Server via ODBC (V5R3V5 ?) On character-Code $EF there is one of the hungarian Characters (big "O" with two accents) sto...more >>

Cast varbinary to Unicode
Posted by Meir Szydlo at 9/17/2007 12:00:00 AM
Hi, I'm working with SQL 2000, I have a table called Items with an Image field called Content, this field contains an XML Serialization, I'm using the following command to extract the XML from the table: SELECT CAST(CAST(Content AS varbinary(8000)) AS varchar(8000)) AS Content FROM Items ...more >>

backup devices v file backups
Posted by Paddy at 9/17/2007 12:00:00 AM
What are the benefits of using backup devices when they are configured as the same place on a disk as a normal backup to file operation? The only one I can see is the that you can backup to a remote disk? Am I missing something? Thaks Paddy ...more >>

Why is Precision 18 the Decimal Default
Posted by Andrew Robinson at 9/17/2007 12:00:00 AM
Hi, In the Decimal datatype, why is the default precision 18 and not 19 as they both allow for a maximum length on 9? Thanks Andrew...more >>

Ms Access to MSSQL
Posted by at 9/17/2007 12:00:00 AM
Hi, Does anyone know of a valid method to import a database from MSAccess to MSSQL? The MSSQL tool is not much of a help so far, considering that I have MSAccess queries that need to be imported as Stored Procedures in MSSQL. If not, does anyone know how to import the SQL queries syntax ou...more >>

Difficult SQL Query Problem with Searching for Downtime
Posted by Idgarad at 9/17/2007 12:00:00 AM
Here is the trouble I need to track system outages based on batched jobs. I have the following data in tables (headers) Job, Start Date, Start Time,End Date, End Time This is a batch schedule with jobs that make a system unavailable. Now there are two types of batch jobs, a start ...more >>

Slow Connection work around
Posted by David S. at 9/17/2007 12:00:00 AM
Hi All! I have access to a view which contains a large amount of data, but is only available over a slow connection. I have several large queries/reports that I must run against it all day long. It is much faster to just select * on the entire view into a temp table and then query that tabl...more >>

bcp problem
Posted by Rahul at 9/17/2007 12:00:00 AM
Hi, I have login the sql server 2005 with Window authontication. and execute following SQL EXEC master..xp_cmdshell 'bcp TestDB.dbo.tblTest out C:\Rahul.txt -c - t -T' And the output is ------------------------------------------------------------------------------------------------------...more >>


DevelopmentNow Blog