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 > june 2006 > threads for thursday june 1

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

querying a text file, waitfor issue?
Posted by steve9 at 6/1/2006 10:32:27 PM
Hello, I'm querying a text file after adding a directory as a linked server. Works fine when executed as separate statements: --separate statements --first this EXEC sp_addlinkedserver txtsrv, 'Jet 4.0', 'Microsoft.Jet.OLEDB.4.0', 'C:\temp', NULL, 'Text' EXEC sp_addlinkedsrvlogin txtsrv,...more >>


different database connection in clr stored proc
Posted by Mark at 6/1/2006 9:41:02 PM
Hi, Is it possible, in a CLR Stored Procedure, to connect to a different database on the same server as the database under which the current connection is for/running? In other words, within a CLR Stored Proc running on database A, is it possible to then connect to Database B, and inser...more >>

Best way to search
Posted by Jeremy Chapman at 6/1/2006 8:48:15 PM
I have a stored procedure declared (shown below) The intent of the stored proc is to return all records where the field values match the criteria specified in the stored proc parameters. I want to specify some or all of the parameter values. What I have written works, but I don't think it i...more >>

SQL to show the number of distinct rows in tbl linked to another
Posted by eric.goforth NO[at]SPAM gmail.com at 6/1/2006 7:40:45 PM
Hello, I'm trying to figure out a SQL query that will Show the number of distinct C_O_Id's to each A_Id. Note that A_Id 18506 is tied to C_O_Id 371 twice and C_O_Id 706 once. So that would be 2 distinct C_O_Id's. I tried using the cube, but it didn't really help. Any idea how to do this? ...more >>

How to write this SQL statement?
Posted by Simon Says at 6/1/2006 7:27:19 PM
Hi all, I've the following records: ID Language ------------------------ 1 DE 1 FR 1 EN 2 DE 2 IT 3 EN I wanted to generate the following result: ID Language ------------------------ 1 DE,FR,EN 2 DE,IT 3 ...more >>

Invalid Column Name in SELECT
Posted by MikeV06 at 6/1/2006 5:40:15 PM
This select works as I expect: SELECT exp_AcctNum, exp_Amount, CAST(Left(dbo.strat(exp_Amount),2) AS INT) AS [Strat Level], SUBSTRING(dbo.strat(exp_Amount),3, LEN(dbo.strat(exp_Amount))- 2) AS [Strata Desc] FROM Expenses Go However, I am concerned about i...more >>

sp4 bug views joins and constants ?
Posted by Hans at 6/1/2006 5:30:52 PM
After installing sp4 I have noticed strange results when joining views with constants: create table a ( a_id int ) go insert into a values (1) insert into a values (2) insert into a values (3) insert into a values (4) go create table b ( b_id int ) go insert into b values (...more >>

Optimizing Bulk Insert
Posted by Ellie at 6/1/2006 4:19:37 PM
I am trying to find the quickest way to have a bulk insert completed. What I have found from tests is: 1. I need to have the batch size set to a minimum of 4% of the source file (otherwise the command just quits with no message). 2. I need to have a clustered index and in the bulk insert c...more >>



Dropping Indexes
Posted by Mike C# at 6/1/2006 4:16:51 PM
I'm doing some bulk inserting into various tables, and I'm dropping all the indexes first, and rebuilding them after the data load. One of the tables has several nonclustered indexes + a clustered index. My question is simple: does the order I drop the indexes make a difference in the speed...more >>

Import queries
Posted by Mitch at 6/1/2006 3:48:01 PM
I am copying data from an Excel workbook/worksheet to a SQL Server 2005 data-mart database table (not previously existing) using the SQL Server 2005 Import/Export Wizard. I would like to do it using an import query that recasts the data types, as opposed to copying the Excel data and letting ...more >>

Consume HTTP Endpoints in Visual Studio 2005
Posted by Naana via SQLMonster.com at 6/1/2006 3:17:04 PM
I'm not a web developer but trying to use Sql 2005 Web Services. I tried to create a Windows Application in Visaul Studio 2005. In the New Project dialog box, I couldn't find Windows Application template to add Web Reference. Anyone has an idea where to get the template. Help. -- Messa...more >>

Whats wrong with this query?????
Posted by JLuis Estrada at 6/1/2006 2:51:06 PM
SELECT exp16.parte_orig AS 'Numero de parte (Salida)', exp50.descrip AS = 'Descripci=F3n de la mercanc=EDa',=20 exp02.umc AS 'Unidad de Medida de Comercializaci=F3n', = sum(exp02.cant_umcom) AS 'Cantidad',=20 sum(exp02.val_mpdlls) + sum(exp02.val_agdlls) AS 'Monto en D=F3lares', = exp02.fr_...more >>

Insert multiple records using select clause
Posted by Bill Nguyen at 6/1/2006 2:30:15 PM
I need to insert new records into a table based on the date range of another table (1 record for each day). for example : insert into table A (column1, column2, date1 ) select column 3, column 4, myDATERANGE from table B where <some criteria> The problem here is that I need a new set...more >>

Renumbering Invoice Nos. through query ?
Posted by Luqman at 6/1/2006 1:56:57 PM
How can I renumber the following Invoice Nos. through Query. After sorting by date, the 1st invoice no. to be started with 2006050001 Current Records in table Before Query InvNo Date 2006050133 12-MAY-06 2006050134 12-MAY-06 2006050135 12-MAY-06 2006050136 15-MAY-06 2006050...more >>

Deadlocks problems
Posted by Richard at 6/1/2006 1:52:01 PM
Hi everybody, I have deadlocks problems, somebody could tell me how is the best way to handle concurrency?? Thanks in advance, RICHARD_SQL...more >>

Getting @@ROWCOUNT from BULK INSERT with BATCHSIZE set
Posted by Aardvark at 6/1/2006 1:28:40 PM
Hello! I have a stored procedure that takes a file name as a parameter and imports the data from there into the appropriate table using the correct format file. I would like to save the number of rows inserted at the end of my stored procedure. Since the file name is variable I use EXEC (@cmd...more >>

Deadlock problem
Posted by gaploid NO[at]SPAM yandex.ru at 6/1/2006 12:48:10 PM
Can somebody help me. I spend 2 days on this problem, and i stuck. i`ve got this error: Transaction (Process ID ***) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.... There is a trace: 2006-06-01 23:36:34.22 spid57 ...more >>

virtual column. How?
Posted by Gomez, AF at 6/1/2006 12:45:52 PM
Hi. How do I formulate sql syntax that includes a virtual column. Actual table: TABLE1 column1 column2 column3 I want to: select * from column1, column2, column3, VirtualColumn from TABLE1. and compute something in the virtual column -- ...more >>

Login Function
Posted by Jose Perdigao at 6/1/2006 12:22:18 PM
Good afternoon I using the following function to get the login from Windows XP ALTER FUNCTION dbo.iLogin () RETURNS varchar(30) AS BEGIN /* Sql Server autentication mode */ IF CharIndex('\',system_user)=0 RETURN system_user /* Windows Autentication mode */ RETURN SUBSTRING(system_user,Ch...more >>

Using embeded AND's in WHERE clause?
Posted by JDeats at 6/1/2006 12:17:19 PM
If I have a three column table, will call it AvailClasses SchoolName, Subject, NumOfClasses --------------------------------------------------------------- Emil, Biology, 3 Emil, Chemistry, 1 Emil, Calculus, 4 Prestwood, Biology, 2 Prestwood, Chemistry, 4 Prestwood, Calculus, 2 Westha...more >>

Advanced Query Question
Posted by JP at 6/1/2006 11:45:25 AM
What I am trying to accomplish is to return a resultset that would look like this: Company.Name Table1.Column Table2.Column Table3.Column Company A y y y Company B n y n Company C n n y Company D ...more >>

Import DBF data to a MySQL Table
Posted by ericpoirier NO[at]SPAM gmail.com at 6/1/2006 11:32:47 AM
Hi I'm trying to sync a DBF file stored on my customer server with the MySQL table on my server. I'm still looking for an automatic way to do it, however, for now i'm trying to find a way to create a small app that will help me do it faster than manually. My question is: how do I import...more >>

Function to determine weekoftheyear.
Posted by Miguel Arenas at 6/1/2006 11:03:01 AM
I looking a function to determine the week of the year. In excel I use WeekNum, but I need this for sql server. thank you....more >>

SQL Performance Problem
Posted by Damon at 6/1/2006 10:58:18 AM
I'm trying to delete 55 rows from two tables and SQL is taking 5 minutes to complete this task. Here are some of the details. The OS is Win 2003 Server with no updates or SP1. Where using SQL2000 version 8.00.760. The size of the database is 10Gigs. I'm trying to delete 5 rows from Table A....more >>

DATETIME as Primary Key
Posted by FredG at 6/1/2006 10:53:02 AM
Hello All, We have a strange issue. Environment: SQL 2K SP3a TableA Definitioin: Col1 varchar(10) NOT NULL Col2 datetime NOT NULL default getdate() Primary Key col1 and col2 Many inserts are occuring and we are receiving primary key vilolations. The Insert ...more >>

Where data = yesterday?
Posted by Joris De Groote at 6/1/2006 10:36:49 AM
Hi I have this query: SELECT * FROM [MIT Retours] ORDER BY [Date] However, I want to have a where in it as well, but I don't know how to write it. I need Where [Read] = Yesterday ... Data in Read is datetime (ex: 8/05/2006 17:20:36 ). Thanks for the help Joris ...more >>

urgent help needed
Posted by Michael Sander at 6/1/2006 10:28:10 AM
We got some sort of a weird problem here... Since a couple of days the log file of the tempdb on ours customer database is growing by about 10 - 20 gigs per day (yes, thats Gigabytes). Since we got only about 100 gigs of free space on that raid, you can count when the system is going to sto...more >>

Help with Dates
Posted by Harry Strybos at 6/1/2006 10:13:37 AM
Hi All I have a column called Expiry_Date varchar(5) e.g. 07/08 This column hold card expiry dates as a string in mm/yy format. I have added another column called CardExpiry smalldatetime and want to convert the above varchar column to smalldatetime. I have tried this which returns: "Syntax ...more >>

composite indexes - a subtle question
Posted by CharlesA at 6/1/2006 9:31:02 AM
I have a table like so CREATE TABLE [dbo].[account] ( [pty_id] [int] NOT NULL , [sort_code] [int] NOT NULL , [account_no] [int] NOT NULL , [account_open_dt] [datetime] NULL , [account_close_dt] [datetime] NULL , [account_nm] [varchar] (50) COLLATE Latin1_General_CI_AS NULL , [market_s...more >>

Convert Access Query w/IIF to SQL Server View
Posted by Holly at 6/1/2006 9:14:02 AM
I am brand new to SQL Server. I had to move my data tables from Access 2003 onto SQL Server 2000. I have just upsized my .mdb using the upsizing wizard and, after some minor changes, have gotten everything to work. Now, I'm trying to focus on speeding things up. I have several nested queri...more >>

remove duplicates, add PK..need help
Posted by Chris at 6/1/2006 9:06:55 AM
I am currently cleaning up a "loose" database, by adding primary keys on a few particular tables that currently have none. The Primary key will contain 2 fields, but before I add the pk, I need to delete any duplicates. There should be none or very few that snuck by the application, so deleti...more >>

Help with triggers
Posted by Robe at 6/1/2006 8:53:02 AM
Hi, I’m doing a database with three tables. The project is a little complex so I will not give details about it. What I need is the following. I need to create a trigger because when a row is deleted from table 1 I need to delete a row in table 2, but the row in table 2 is determined ...more >>

Retrieve size of db
Posted by Tony at 6/1/2006 8:49:22 AM
Hi all, given a certain SQL Server database (2000 or 2005), I need to execute queries/commands from a .NET app in order to retrieve the following information: 1) Database size 2) List of tables 3) Each table size 4) List of indexes 5) Each index size I'd appreciate any advice or point...more >>

How to convert from old style join to ANSI ?
Posted by phils at 6/1/2006 8:48:54 AM
Hi, I've got a query (below) that I'm trying to convert from old style "*=, =, =*" join syntax to ANSI. On the bottom is my result but it's throwing the error "Subquery returned more than 1 value. This is not permitted ......". Thanks in advance! SQL2000. SELECT t1code, t1desc, (SELECT ...more >>

Standby Server... transfering dbs
Posted by JDP NO[at]SPAM Work at 6/1/2006 8:45:58 AM
I started originally on how or ways to get data from a primary server to a standby server. I've had wresltling matches w/replication and associates that had months of implementation and monitoring, tweaking to get it right and keep it running, so that was not my first choice. Anyway, I aske...more >>

Updating two tables in one Update statement
Posted by Jami at 6/1/2006 8:33:28 AM
Can it is possible to update more than one table update at once in SQL server, e.g i have to update three tables with same column depnding on value from one table. i have to issue three update statements to achive this. Can this is possible in one statement Regards, Jami *** Sent via D...more >>

JDBC driver question
Posted by Adrian at 6/1/2006 8:32:44 AM
I have installed the Snefru SQL Creator and have to specify a JDBC driver. I am using SQL Express. Could someone please tell me the file location? Many thanks, Adrian ...more >>

Get last raws from a table
Posted by Hitesh at 6/1/2006 8:22:01 AM
I know we can use simple command select top 20 to select top 20 raws... is there a sql command for last raws? Thank you hj ...more >>

bcp from a named instance
Posted by GH at 6/1/2006 8:10:02 AM
The instalation has SS2K as default instance and SS2K5 as a named instance. When runing the following where the db is on the SS2K5 instance: bcp <dbname.dbo.tablename> format nul -T -n -f <filename>.fmt I get the following: SQLState=37000,NativeError=4060 Error=[Microsoft][ODBC SQLServer ...more >>

sysdepends table issue
Posted by Mark at 6/1/2006 7:56:01 AM
All: I have a stored procedure that uses select statement against certain tables in the database. Stored procedure works fine however when I run sp_depeds against this procedure, I get object has no dependecies message back. When I run sp_depends agaisnt table name, I see the same message t...more >>

PROGRAMATICALLY ELIMINATE DUPLICATE ADDRESSES
Posted by Don at 6/1/2006 7:16:02 AM
I am trying to find a way to eliminate duplicate addresses from a table. I have a table that is imported from a seperate system so I have no control over it but I need to be able to design a query that brings out last name, first name, zip code, city, and state, address1 and address2 for a ma...more >>

BULK INSERT from secured share
Posted by Aardvark at 6/1/2006 6:26:14 AM
Hello, I am trying to use BULK INSERT to import data from a file that resides on a shared drive. I've read many posts about this, but my situation has a slight wrinkle (or two). The network people here have granted one account that has access to this shared drive and I can map to that drive u...more >>

Error 208
Posted by Luca at 6/1/2006 5:58:56 AM
Hi, every morning about 06.03 AM in DB PROBA there is the follow error: Event Type: Error Event Source: MSSQLSERVER Event Category: (2) Event ID: 17052 Date: 6/1/2006 Time: 6:03:22 AM User: N/A Description: name database: PROVA Error: 208, Sev...more >>

Tempdb
Posted by artematico at 6/1/2006 5:50:07 AM
Hi, My name is Luca and I have a problem with the db tempdev (db file and not log file). Every saturday about 23.30 PM the db grow till 27 GB (normally the size of tempdev is 100 MB). I don't undesrstand the reason og the grown. Somebody can help my? Thanks a lot for every answer ...more >>

sql assistance needed asap! thanks
Posted by andy_e2007 at 6/1/2006 4:38:01 AM
i've been using asp based code to run comparisons from one dbo table to another, then update the other with the changes or additions on the original one, this through asp is time consuming as you can imagine, and causes the server to bog down for a prolonged period. is there a way through a s...more >>

sprocs v functions and caching
Posted by CharlesA at 6/1/2006 3:52:03 AM
Hi folks, first of all, I'm using SQL server 2000 sp3 I've got a fairly complex report that using complex joins and a couple of subqueries , some Cases and GROUP BYs and the report is part of a hierarchy of reports there are 4 sprocs in all, and each one makes a call to one particular UDF ...more >>

Query which returns only every 5th Row with a Openquery
Posted by benwilliams269 NO[at]SPAM gmail.com at 6/1/2006 1:03:37 AM
Hi @all, I'm going crazy here. I need to modify this Query so that it returns only every 5th Row because I have to generate Chart with that data and it would take to long to get 50000 rows from the DB (at the moment it takes about 2 minutes only for retrieving the data). The problem is that I ...more >>

Can I call stored procedure inside the case statement
Posted by Veeru at 6/1/2006 12:22:01 AM
Hi Can I call stored procedure inside the case statement. ...more >>


DevelopmentNow Blog