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 > october 2005 > threads for monday october 3

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 31

what mean the tables are truncated
Posted by Joe at 10/3/2005 10:36:01 PM
what mean the tables are truncated...more >>

please help me out
Posted by raghu veer at 10/3/2005 10:15:02 PM
my mdf and ldf are in 1 drive only. i am facing query timeout problem for this server which is mainly used for employees if i separate ldf into another drive will there will be any perf benefit can i add another log file how to clean up my log file...more >>

Full Outer Join question.
Posted by Meher Malakapalli at 10/3/2005 6:27:38 PM
Hi, If I have two tables A and B and I am trying to insert rows, update rows and delete rows in table B based on table A is it possible to do it one SQL statement with a full outer Join?. I have written the SQL for getting the data using a full outer join but want to achieve Inserting , up...more >>

SQL SCRIPT SYNTAX QUESTION!!!...
Posted by tom d at 10/3/2005 4:29:02 PM
Can someone explain why this sql statement does NOT work. DECLARE @test varchar(30) SELECT @test = 'TEST' SELECT @test, count(*) from @test Assuming that table TEST is in the database. I would expect to get something like this from the script, should I: ------------------------------ ----...more >>

Chasing my tail with this design
Posted by Steve at 10/3/2005 4:25:55 PM
I've never been great at DB Design, I try though. Here is my situation. We manufacture hardware devices(startup Co.). I write the firmware for the devices and generally all other software issues. As we are growing, we were having more and more customers wanting "customized" versions of the...more >>

QUESTION
Posted by Tdar at 10/3/2005 4:17:15 PM
Hello say you have data in one record that is semicolon delimited example: 231232;test;1321;dsfwe;wefdw;www;0 i want to be able to split this data in seprate fields using a stored procedure: In vb i would use the spliter = Split("231232;test;1321;dsfwe;wefdw;www;0", ";") transi...more >>

Correlated subquery question
Posted by DWalker at 10/3/2005 3:27:19 PM
I'm sure this is well-known to all you experts out there. I found the following on the Net: A frequent question posted on here is something like "How do I list all of my customers along with their most recent order". You can achieve this using a correlated subquery. A correlated subquery...more >>

Not getting Identity back
Posted by David at 10/3/2005 3:16:54 PM
I have the stored proc below that is not returning the new identity field. Can someone help? Thanks. David CREATE PROCEDURE [ms_insRepairOrderTasksDup] (@TaskID [int], @TaskIDNew [int] OUTPUT) AS INSERT INTO [dbo].[RepairOrderTasks] SELECT [IDfromABS], [EmployeeCode], [Repa...more >>



Structure exportation
Posted by Montag at 10/3/2005 1:56:40 PM
Hi everybody I was looking for some tool that exports the structure of the tables of my SQL Server database. I've found some, but noone that exports also the description of the fields in the tables. Anyone knows about a tool that does it? giovanni ...more >>

data Type equivalent in SQL Server
Posted by Arul at 10/3/2005 1:56:06 PM
What is the sqlserver equivalent of MS Access INT datatype?...more >>

Fun (trouble) with outer join
Posted by jeffpriz NO[at]SPAM yahoo.com at 10/3/2005 1:51:33 PM
Okay, I'm having an issue with an outer join that is just confounding me! Can somebody help explain. I started out with a large query that was not returning all of the data that I wanted, so i paired it down to this simple outer join: SELECT E.EMP_RNG_CDE FROM DATA_TABLE B LEFT OUTER JOIN ...more >>

problem querying a TEXT field
Posted by darrel at 10/3/2005 1:44:06 PM
I have a query that works, until I try to also grab one of the fields that is set to a 'text' datatype. I can grab any field, and it works fine, but once I try to grab the data from the 'text' field, I get the following error: [Microsoft][ODBC SQL Server Driver][SQL Server]The text, ntext, and...more >>

txt file with trailing sign
Posted by Patrice at 10/3/2005 1:33:10 PM
Hello all, I am importing from a text file a field that needs to end up in a sql table as decimal type. The field has numbers and then a trailing sign (+ or -) to indicate pos or neg.. How can I conver that filed to numeric with the sign in front of the number? e.g.: 000032897+ should be...more >>

Constraint question
Posted by Chris Burgess at 10/3/2005 1:28:22 PM
I have 'Table1' with two fields: - RecID - POID I want to allow records to be entered in Table1 where the same RecID and POID can exist across multiple records in Table1, but I don't want to allow a POID to exist in Table1 twice with different RecIDs. This is OK RecID | POID 1 ...more >>

Modify Multiple Stored Procedures
Posted by Ryan.Chowdhury NO[at]SPAM gmail.com at 10/3/2005 12:24:05 PM
I have built 20+ stored procedures using an ADP front end. The stored procedure are constructed in a similar fashion, the call an outside procedure with certain parameteres including a date parameter. an example of a stored procedure: ALTER PROCEDURE sp22_IRRSinceInceptionByInvestorStrategy...more >>

Cannot update
Posted by Ed at 10/3/2005 12:10:02 PM
Hi, I have the following update statement but using a linked server Update txq005dev1.sprint.dbo.becinfo set unit = a.unit from becinfo a inner join txq005dev1.sprint.dbo.becinfo b on a.HRGType = b.HRGType and a.ChargSubType = b.ChargSubType I am not sure why it doesn't work. Can I no...more >>

Code to calculate lat/lon given a lat/lon and distance?
Posted by Snake at 10/3/2005 12:03:04 PM
My math skills are not up to it so I have to ask for it! I need a procedure which accepts one lat, lon, and Distance(in feet? miles?) and returns the lat's and lon's which describe a square around the given lat/lon with 2 * Distance on a side. This will be used to search a database for o...more >>

TSQL and database recovery
Posted by Joe at 10/3/2005 11:47:02 AM
Jeez, Just can't remember the command to display the database percent recovery complete via query analyzer? TIA...more >>

Trigger After Delete - Multirow
Posted by Michael Maes at 10/3/2005 11:24:02 AM
Hello, I'm facing a Multirow-subquery issue: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated. I can't figure out what I'm doing wrong. Anybody any c...more >>

How to test a stored procedure ? how ?
Posted by Carlos at 10/3/2005 10:50:37 AM
Ok , I'm new in stored procedures, I created one, so I want to test it without going and coding a program in C# or VB.NET, is it any way to run it where it will ask my parameters and get the result using the SQL Enterprise Manager ? Thanks ...more >>

DATA COMPARE Question????
Posted by tom d at 10/3/2005 10:30:06 AM
I have two tables as: table1 tablename tablecount a 1 b 2 c 3 d 4 .. .. table2 tablename tablecount a 1 b 2 c 10 d 11 .. .. .. How d...more >>

Filling out gaps in a date based select statement
Posted by Chris Strug at 10/3/2005 10:24:26 AM
Hi, I have a query which simply returns a count of a particular field by week number. My query as it works fine however for weeks where there are no data it obviously doesn't return a row. My problem is that is I wish for the statement to return a zero for those weeks with no data - I'm jus...more >>

import from Excel file
Posted by krzys[wawa] at 10/3/2005 10:17:45 AM
I have some difficulties with import xls file to sql server. The problem is I try to import excel-html file but not ordinary excel-binary file. I use to use query like that : select 1,2,3,4,5 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0; DATABASE=c:\zeszyt1.xls;HDR=YES', 'Select *...more >>

Convert Week into Start and End Date
Posted by Ken at 10/3/2005 9:59:30 AM
Some of our sales data is a week/year format like this... SELECT DATEPART(wk, GETDATE()) AS 'Week', DATEPART(yy, GETDATE()) AS 'Year' I would lie to convert it to mm/dd/yy Start - mm/dd/yy End date. Thanks! ...more >>

Clarification on the ROWCOUNT statement
Posted by John Rossitter at 10/3/2005 9:50:06 AM
Hi All, I just wanted to get some clarification on the ROWCOUNT statement in T-SQL. I'm presently using it to limit the number of rows returned in SELECT based SPs. However I'm just curious as the effect of this keyword on the global scope of SQL operations. Does setting ROWCOUNT to 25 i...more >>

Detect Record Conflict:
Posted by Graeme Stow at 10/3/2005 9:38:24 AM
In a table or 'shifts' for employees i'm trying to test a proposed new shift for conflicts, the employee's shifts must have 12 hours between them, This makes sense to me but, is it going to be efficiant considering the table could have ten's of thousands of shifts. IF EXISTS ( SELECT R....more >>

Erroneous behaviour of COALESCE versus ISNULL???
Posted by kurt sune at 10/3/2005 9:17:17 AM
I am getting very confused of why COALESCE doesnt report NULL as NULL. Can somebody please explain the behavoiour described below??? Create these tables: create table dbo.Warrants ( WarrantId bigint not null constraint WarrantsPKCO primary key nonclustered (Warran...more >>

Kick off procs
Posted by Robert H at 10/3/2005 9:11:03 AM
Hello. I was wondering what is the best way to kick off multiple procs trapping the ones that had an error. Here's an example of what I came up with. alter procedure dbo.testError @problem int = 0 OUTPUT AS set nocount on print 'start' Declare @error_msg int set @error_msg = 0 set @...more >>

Setting ANSI_NULLS on all databases
Posted by Wade Bart at 10/3/2005 9:07:04 AM
I'm brand new to SQL statements. How do I set ANSI_NULLS to ON for all databases on a SQL 2000 server to ON. SQL Best Practices analyzer recommended changing to this value. I know how to do SET ANSI_NULLS ON, but how do I apply to every database and/or table? ...more >>

bad query plan when using parameterised queries on partitioned vie
Posted by chris at 10/3/2005 8:52:01 AM
Recently I found rather a nasty consequence by using parameterised queries on a partitioned view. I have a .net app that sends parameterised queries to SQL Server 2000. SQL Server obliges by caching the query plan to increase efficiency of subsequent queries. In my case the query is runn...more >>

Datatype change INT to BIGINT on a large table
Posted by Venkat at 10/3/2005 8:50:49 AM
Hi folks, I have a table which is of 500 GB in size. I need to change the datatype of a column from INT to BIGINT. When I tried making this change from Enterprise Manager, it was throwing log space is full. I also truncated the log and tried again, eventhen I face the same problem. Also I ha...more >>

Recordset to Array
Posted by jd at 10/3/2005 8:48:39 AM
Using Visual Basic can you assign a resultant recordset to an array without looping through the number or returned records and fields. Dim strArray() as String Dim rs As ADODB.Recordset rs.Open SQLStatement, Connection strArray = rs Many thanks for any assistance....more >>

Transaction hangs
Posted by Arne at 10/3/2005 8:08:09 AM
I have a daily transactions with 40 updates in one table and 200 updates in another table. Once a week this transaction hangs and causes a lot of problems. When it hangs next time, how can I find the cause of this problem? I am on SQL 7.0 and will upgrade to SQL 2000 shortly. I am using ADO.net...more >>

sp_reset_connection crazy
Posted by JP at 10/3/2005 8:01:07 AM
We have exec sp_reset_connection executing about every 2 secs. Howver there are 5 databases on this server. How much is too much? -- JP ..NET Software Develper...more >>

Dynamic Reference to Linked Server
Posted by Bruno at 10/3/2005 7:50:03 AM
Dear all I got a problem that I would like to use a dynamic statement to query data from a linked server (it is not guaranteed that the used database remains on this server or the Test-Database would be renamed). I tried to use the OPENQUERY-Functionality or to set up a SP which uses Par...more >>

IMEX=1 in OpenDataSource
Posted by Walt Mallon at 10/3/2005 7:45:28 AM
I'm having an issue with selecting data from an Excel 2002 spreadsheet using OpenDataSource (or DTS for that matter). Excel will sometimes identify the column type as numeric and ignore all character data in the column, returning nulls instead of the data (known issue - http://support.micro...more >>

How to script adding a field to a table
Posted by Mark at 10/3/2005 7:44:51 AM
Hi - I would like to know what sql to run in Query Analyzer to add two fields to an existing table (I know you can do this in Enterprise Manager - but I'd like to be able to send a script to someone to let it happen automatically). Column Name: IDCreated DataType: DateTime Length: 8 Allow N...more >>

Updating records accross two databases
Posted by Stephen at 10/3/2005 7:28:11 AM
I have two databases and I am trying to do something with the Merge table in one database and am having a little difficulty writing the logic. Basically in DB1 I have a table which is full of records outling the merges of URNs. Example below. Database1 Table: MergeList RecNo FromURN ...more >>

user permissions
Posted by HP at 10/3/2005 7:28:05 AM
i added a new user group to sql server. all the users in that group should be able to access the database.i check the data-reader,data-write and public options.for some reason the users are not able to access the database. they are able to access the database only if i turn on system admins pr...more >>

SQL Server Logins
Posted by HP at 10/3/2005 7:19:37 AM
i have some issues with permissions. i added a new user group to sql server.i want to give them permissions to access the database but i don't want them to be the database admins. for some reason if i don't make them system admins they are not able to access the database.Am i missing something...more >>

Option for ignoring extra parameters sent by name to a procedure?
Posted by truls.kvaase NO[at]SPAM gmail.com at 10/3/2005 6:50:51 AM
In our database, there are lots of procedures who have obsolete parameters defined. For example, in the procedure defined as: create procedure proc_MyProc @myparam1 int, @myparam2 int as begin blah-blah-blah end ....let's say that @myparam2 has gone out of use, so we want to re...more >>

sp_msforeachdb
Posted by Tony at 10/3/2005 6:28:23 AM
I am learning, how can i use sp_msforeachdb to see what nt user has access on a database and the rights they have? or can you help me with the code to do so.. -- Eager to Learn...more >>

Messages back from SqlServer while a Backup is being completed?
Posted by Jason Haley at 10/3/2005 5:10:03 AM
I have a WinForms application in which I am wrapping the backing up of a sql database. In order to back up the database I am using the BACKUP DATABASE t-sql and the STATS=5 in order to get the progress back from sql server. Here is the exact script: BACKUP DATABASE test_dvpt TO test_Backup...more >>

Database crashed its very urgent
Posted by Srihari at 10/3/2005 3:01:02 AM
Hi All, one of my database is suddenly crashed with power fluctuation and when i started the server it is showing "not able to connect database". I have taken backup and i was trying to attach database in other system. It has given me the following error. --------------------------- Mic...more >>

Are NULL Counts reliable?
Posted by marcmc at 10/3/2005 2:46:01 AM
select count(*) from Table(nolock) -- 11972198 select count(*) from Table(nolock) where Vh_SummVeh_id is null -- 11894085 select count(*) from Table(nolock) where Vh_SummVeh_id is not null -- 9546220 ....doesn't quite make sense, the collation of the field is NULL and datatype is...more >>

Foreign key and indexes
Posted by Rippo at 10/3/2005 2:44:02 AM
I have a question about foreign keys and indexes that I am unsure about. If a table has a foreign key does this column have a non clustered index assigned to it as default (that is hidden)? or does it make sense to add a non clustered index to the foreign key column in the foreign key table? ...more >>

OpenRowset - Data loss in Excel
Posted by Madhivanan at 10/3/2005 2:27:34 AM
When I use OpenRowset method to export data to Excel file, only 255 characters of columns are allowed to be copied. I get this error when data is more than 255 characters Server: Msg 8152, Level 16, State 4, Line 6 String or binary data would be truncated. The statement has been terminate...more >>

Changing User Permission
Posted by Tony at 10/3/2005 2:03:42 AM
I need a script for changing user user permissions on each database, how do i achieve this? -- Eager to Learn...more >>

Dynamic SQL!
Posted by Adam Knight at 10/3/2005 12:00:00 AM
As much as i would prefer not to..it appears the only way i can acheive something is to use dynamic sql. I have constructed the test query below, but only recieve invalid column name errors. Can someone tell me where i am going wrong? I am obvsiouly missing something quite simple?? D...more >>

calling a exe . reading from a text file from a stored procedure
Posted by Tdar at 10/3/2005 12:00:00 AM
Hello, Is it possiable to call a exe file from a sql stored procedure, and what do i need to look into to do this. also Is it possiable to read a text file from a sql stored statement? ...more >>

large amounts of data
Posted by Michael C at 10/3/2005 12:00:00 AM
I've got a database that has most of it's data in one table, say 90%, and the other 10% across 20 or so tables. I'm finding that performance with this table is slowing down to unacceptable levels when inserting data. I've managed to get good enough performance when reading data from the table....more >>

stupid question regarding joins
Posted by Chris Strug at 10/3/2005 12:00:00 AM
Hi, Probably an obvious question but I'm havign some real difficulty getting this to work. I have the following query: SELECT datepart(wk, datein) AS WeekNo , count(movementno) as StockIn FROM stock WHERE YEAR(datein) = '2005' AND GROUP BY datepart(wk, datein) Now I want to ensure ...more >>

Double Quotes!
Posted by Adam Knight at 10/3/2005 12:00:00 AM
What is the normal procedure for enclosing string variables in Dynamic TSQL. I've tried using: SET QUOTED_IDENTIFIER ON SET @sqlquery = 'SELECT TOP ' + CAST(@oqs As varchar) + ' NEWID() AS ID,asmt_v2_question_id, qtext, qindex, qtype, answer_url ' + 'FROM ' + 'asmt_v2_questions ' +...more >>

DLL missing or ???
Posted by Valentin Albastroiu at 10/3/2005 12:00:00 AM
I have SQL server 2000 and access 2003 adp file always disconnect Dim cnn As ADODB.Connection Set cnn = New ADODB.Connection run-time error 429 ActveX component can't create object How repair this without reinstall all?? ...more >>

Stopping Blocking on Stored Procedures
Posted by Daren Hawes at 10/3/2005 12:00:00 AM
Hi, I have this simple SP.. CREATE Procedure stp_SaySo_Increment_Hits @RestaurantID int as declare @CurrentHits int select @CurrentHits = RestaurantHits from dbo.tbl_SaySo_Restaurants Where RestaurantID = @RestaurantID Update dbo.tbl_SaySo_Restaurants Set RestaurantHits = (@Curr...more >>


DevelopmentNow Blog