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 > april 2007 > threads for thursday april 26

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

Database hanging for no apparent reason.
Posted by David W at 4/26/2007 11:48:31 PM
I have this database in our stage environment (SQL 2005) that keeps hanging for no apparent reason. It is only used by one person so the load is negligible and there are no other databases on that instance. There is a second instance on the same server and those databases are fine. The serv...more >>


Strange thing in MSSQL 2000 which doesn't occur in MSSQL 2005
Posted by Alain Quesnel at 4/26/2007 6:30:05 PM
Try to compile this function: USE NORTHWIND GO create function dbo.fnTest (@inCustomerID nchar(5), @inDate datetime) returns table as return ( select * from ORDERS where OrderDate = @inDate and CustomerID = @inCustomerID ) Can someone tell me why this works in MSSQL 2000: declare @...more >>

Return 1 of 2 Select Statements
Posted by Derek Hart at 4/26/2007 5:57:55 PM
I simply want to do this in a stored procedure: If @myValue = 1 Select Field1 From myTable Else If @myValue = 2 Select Field1, Field2 From myTable In query analyzer I get the right select statement, but in dotnet or access I get only the first select statement, unless I change it...more >>

Adding table as SP parameter and not using dynamic sql
Posted by VMI at 4/26/2007 4:55:50 PM
I have a huge SP that initially queried Table1. Recently, the data in Table1 was divided into several tables. Now I need to run this SP with any of those tables. How can I "tell" the query in the SP to select from Table1, or Table2, or Table3 without using 'EXEC' and without having to dup...more >>

search in the entire database.
Posted by Rodrigo Guerra at 4/26/2007 4:26:52 PM
hi, today I have a database with 30 tables and i need to find a specific string that can be in any field and any table. is there a way that i say like 'select * from the entire database where anyfield like '%mychar%' ' thanks, Rodrigo Augusto Guerra ...more >>

SQL Server 2005 performance issue
Posted by ChrisB at 4/26/2007 4:21:51 PM
Hello: I am trying to open a SQL Server 2005 table with 64 records (each record is about size .5K) from within SQL Server Management Studio and it's taking about 25 seconds. The slow performance seems to be intermittent - there are times when the table opens in a fraction of a second. A...more >>

commas
Posted by Bob McClellan at 4/26/2007 3:48:50 PM
What's the best way to Cast or Convert 6789 to 6,789? tia bob....more >>

reserved keyword function
Posted by gracie at 4/26/2007 3:06:02 PM
I'm migrating a database from sybase to ms sql 2005 and one of the tables is named function. The table loaded properly but any reference to the keyword in the creation of other objects fails with the following error: Msg 156, Level 15, State 1, Procedure dbo_rec_series_ri, Line 21 Incorrect ...more >>



Order of columns in a clustered index
Posted by DWalker at 4/26/2007 2:01:50 PM
I have a table with the following structure: CREATE TABLE [dbo].[Price_Master]( [FUND_ID] [varchar](22) NOT NULL, [PRICE_DATE] [smalldatetime] NOT NULL, [PRICE] [decimal](21, 8) NOT NULL, CONSTRAINT [PK_Price_Master] PRIMARY KEY CLUSTERED ( [PRICE_DATE] ASC, [FUND_ID] ASC )WITH (PA...more >>

Help with a query
Posted by Mangler at 4/26/2007 1:46:52 PM
I have the following table: CREATE TABLE [dbo].[warehouse_tracking]( [idtrans] [int] IDENTITY(1,1) NOT NULL, [model] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [type] [char](1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [qty] [int] NOT NULL, [date] [datetime] NOT ...more >>

Displaying File Names in SQL
Posted by Jason at 4/26/2007 1:40:00 PM
Does anyone know of a way to display all file names in a specific directory from SQL? Is there an extended stored procedure simular to xp_subdirs that will display file names instead of sub directories? I am using SQL Server 2000 sp4, Windows 2003 sp1....more >>

Stored Procedure issues
Posted by Daniel at 4/26/2007 1:33:35 PM
I have 2 stored procedures, one works and the other doesnt.. the only difference between both of them is the field names.. and the tables used. If i comment out the field in question it actually works.. so i dont understand why it doesnt like that field... and its accuring on all my stored pr...more >>

Trigger to insert rows into another table
Posted by eqbalz NO[at]SPAM gmail.com at 4/26/2007 12:29:19 PM
I need to write a trigger to insert rows into another table if the current inserted row(s) is not already in that table. I was able to do it for insertion of one row, but when multiple rows are inserted it doesn't work. Below is my trigger: ===============Begin Trigger Source===== CREATE TRIGGE...more >>

Split a Char field into 2 at the space
Posted by SJ at 4/26/2007 12:00:02 PM
I have a column Name which is a char field of length 25. The field holds both first and last name - for eg, John Williams - with a space or spaces separating first and last name. I want to be able to select the first name and last name - how can I do it in SQL Server 2000?...more >>

leading zeros on integer
Posted by Reddy at 4/26/2007 11:52:02 AM
I have table employee: CREATE TABLE [dbo].[employee]( [employee_id] [int] NOT NULL, [dept_id] [tiny] NOT NULL) I want dept_id column to be integer and it should allow 00 and it should take 01 thru 99. I needs to be a two digit number greater than or equal to 01 with leading zeros. how...more >>

Cursor through tables for record counts
Posted by schaapiee at 4/26/2007 9:59:50 AM
SQL Server2000. I have a database, we will just use Northwind, and I need a cursor to go through each user table and return the table name, and row count per table and put the results into a temp table or just ouput them. There are about 600 tables to cycle through. Let me know if you need mo...more >>

Various levels categories
Posted by shapper at 4/26/2007 9:00:16 AM
Hello, I would like to display on an Asp.Net 2.0 web site a Folder Tree where each node is a category. I might have only main categories or sub levels (1,2,3, ...). I want the categories to be on an SQL2005 database because I will then associate each articles to the categories. If I woul...more >>

Urgent Counting the number of records in a text file
Posted by Pogas at 4/26/2007 8:58:01 AM
Hi I routinely use SSIS to extract huge files and supply to clients as text files after zipping with PKZIP using command line.As far as I can tell, PKZIPC has no switch to output a log file. Is there anyway of using T-SQL to find out how many records exists in a text file? The text f...more >>

sql query help
Posted by Pradeep at 4/26/2007 7:37:37 AM
I have the below table fdate, customer(text), delivery(number) 1-Jan,10,100 1-Jan,20,200 2-Jan,10,100 2-Jan,20,200 3-Jan,10,100 3-Jan,20,300 <-- change in delivery I want write a query which will display the results as fdate(now as text),customer,delivery 1-Jan to 2-Jan,10,100...more >>

Table is not refreshing
Posted by Vandy at 4/26/2007 7:04:09 AM
Hi, I have a peculiar problem. I have a table A that showing old data but the same table (Assume table B) in another server has updated data. I dropped the table A and recreated again and downloaded the data from the same source. The table A has old data only. Even I tried to copy from table ...more >>

SQL Select Statement
Posted by RickSean at 4/26/2007 7:02:02 AM
CREATE TABLE [dbo].[Category]( [CatID] [varchar](5), [Cat1] [varchar](5) NULL, [Cat1a] [varchar](5) NULL, [Cat2] [varchar](5) NULL, [CatA1] [varchar](5) NULL, [Cat1b] [varchar](5) NULL, [Cat1c] [varchar](5) NULL, [Cat1d] [varchar](5) NULL, [Catd1] [varchar](5) NULL, [CatA] [varch...more >>

Strange Error Message when attempting to create a job
Posted by tomKry at 4/26/2007 5:54:01 AM
On one server running SQL Server 2005, I am getting a very strange error message whenever I attempt to create a new job under the SQL Server Agent inside of the management studio. Unable to cast object of type 'Microsoft.SqlServer.Managment.smo.SimpleObjectKey' to type 'Microsoft.SqlServe...more >>

How to get only the Date from a datetime?
Posted by Jens Kluesener at 4/26/2007 4:22:10 AM
Hi I need only a date value of a datetime into a datetime. I think that datetime is represented by a float value where the value in front of der dot is the day and the rest is the time. E.g. 18265.246. I need only the date value in a datetime Datatype. E.g. 18265. I do not need a string! H...more >>

Query Help
Posted by Pradeep at 4/26/2007 3:53:25 AM
My table structure is as below fDate (Date), Customer (text), Del (number) 1/Jan/07, 10 , 100 1/Jan/07, 20 , 200 2/Jan/07, 10 , 100 2/Jan/07, 20 , 200 3/Jan/07, 10 , 100 3/Jan/07, 20 , 300 <-- note the difference I want to display the result as Date ( as text) , customer , De...more >>

(DROP INDEX / TRUNCATE) or (TRUNCATE / DROP INDEX)
Posted by Bob at 4/26/2007 3:52:05 AM
If you've got a big table (ie many rows say 10million? medium row size 200 bytes?) with a clustered index, is it quicker to: drop the index truncate the table OR truncate the table drop the index Is there a same true for a table with a clustered and a number of non-clustered indexes?...more >>

sql update
Posted by farshad at 4/26/2007 3:18:03 AM
What is wrong with this query please? declare @tblSpotRateCodes table ( ID int identity(1, 1), SpotRateCode varchar(6) --length of 6 because spotRate code is combined of two currencies... ) declare @tblSpotRateValues table ( ID int identity(1, 1), CurrencyPairID int null, ...more >>

compare varchar in Stored Procedure
Posted by yokejen NO[at]SPAM gmail.com at 4/26/2007 2:25:20 AM
Hi, How can I compare string (varchar) in Stored Procedure (SQL 2000/2005) ? I want to find the occurance of substring in a string. Understand there is no such built in function like INSTR. No need to know the position of the occurance, but as long as the substring is exist. How to do it ? ...more >>

openxml
Posted by farshad at 4/26/2007 2:12:03 AM
<marketData> <date>10-jan-2001</date> <producedBy>person1</producedBy> <SpotRates> <SpotRate code="USDCAD"> <values> <value type="BID">1.1276</value> <value type="ASK">1.1277</value> <value type="MID">1.127649997783</value> </values> </SpotRate> <Spo...more >>

Query with a look-up function
Posted by Dirk at 4/26/2007 12:34:01 AM
I'm using MS-SQL 2000 to grab some event data from a third party system that I cannot change. This data will eventually be used to generate some statistics. Let's assume there are two tables: CREATE TABLE Events ( timestamp, userID, eventdata ) CREATE TABLE Logon ( timest...more >>

BUG ? can't "select INTO"
Posted by keyser soze at 4/26/2007 12:00:00 AM
hi i have a query that works FINE, returning 826 rows in <1 seconds the problem is: when I attempt to "select... into" the same statement, sql don't finish ever the query i awaited around 8 minutes that is MUCH MORE than 1 second !!!! what happens ? THIS QUERY WORKS - - - - - - - - -...more >>


DevelopmentNow Blog