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 > january 2004 > threads for thursday january 15

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

best practice on hard-coding db name?
Posted by Jeff Sahol at 1/15/2004 11:05:26 PM
I've been working with a client who has hard-coded the database name throughout the code, both client-side inline code (c#/asp.net) code and plsql. In other words, "select blah from MYAPP.dbo.tablename..." instead of "select blah from dbo.tablename". There is only one db in use. This has c...more >>


Decimal Scale
Posted by Mark Norris at 1/15/2004 10:42:51 PM
Hi Hope someone can help me with this problem as it's driving me nuts! We have an app where the user can define the number of decimals that they want to use. We store the value (between 2 and 6) in a table. Let's call it tblSetup and the column holding the number of decimals we'll call Qty...more >>

Error Capturing
Posted by Rez at 1/15/2004 10:31:08 PM
Hello: I have a table in SQL server called Employee. Have 3 Primary keys: Name Phone Sex I insert records using VB6. If I have duplicate values, I like to capture the error, so I continue writing into the table without inserting the duplicate values. Where do I capture this error, in VB6 or in ...more >>

Ok for .sql but not with a view ?
Posted by Lapin at 1/15/2004 9:36:15 PM
Hi, I have the following code that i can save as a .sql file, but not as a view: SELECT Clients.C, SUM(CASE WHEN A = 0 THEN B END) FROM Clients INNER JOIN Customers ON Clients.C = Customers.C GROUP BY Clients.C; Any help would be appreciated ! Thanks....more >>

Absolute NEWBIE just needs the simplest question answered
Posted by Boe at 1/15/2004 9:29:44 PM
Sorry, I know absolutely nothing about SQL other than how to set up a server for it. If I have a server named ABC with a database named 123 on it, and I want to run a query on the database to find out how many records have the field "day" with a value of Monday, how do I run the query? Thank ...more >>

using "case"
Posted by TJS at 1/15/2004 9:06:56 PM
this doesn't compile - error near "case" what's missing ?? CREATE PROCEDURE spxx ( @ID int, @Number int, @Type nvarchar(20) ) AS CASE WHEN @Type = 's' THEN INSERT INTO Users ( userID,S_Number) VALUES ( @ID, @Number ) WHEN @Type = 'c' THEN INSERT INTO Use...more >>

Help for query
Posted by wd1153 at 1/15/2004 8:41:16 PM
Hi, All I have a table as following: CREATE TABLE [dbo].[tblPatient] ( [VisitingID] [bigint] NOT NULL , --Key [MedicalHistoryID] [int] NOT NULL , [AdmitingDate] [datetime] NOT NULL , [DischargeDate] [datetime] NOT NULL , [PatientCategory] [varchar] (5) COLLATE SQL_Latin1_General_CP1_...more >>

Date conversion question
Posted by AndrewM at 1/15/2004 6:52:19 PM
Hello, This works fine as long as the dates are as follows. set @start = '20040106' set @finish = '20040116' but as soon as I use a different date format and try to convert it I get an error. Can anyone suggest why ? Thanks, Andrew. *************************** declare @start dat...more >>



who is dbo?
Posted by haode at 1/15/2004 5:09:35 PM
who is dbo? ...more >>

Insert data into linked tables ?
Posted by Scub at 1/15/2004 4:58:09 PM
Hi, I've some trouble to insert records in linked tables with unique identifiers (ID) from SP. How to process that kind of insert? Any idea or basic sample? Thanks...more >>

how can I upload an image
Posted by Patrick at 1/15/2004 4:47:19 PM
Hi Freinds, SQL 2000 I have a .jpg ot .bmp file and want to save into a image type filed. How can I save and read back the image from table ? Thanks in advance, Pat ...more >>

SQL View Criteria
Posted by Guy Hocking at 1/15/2004 4:12:01 PM
Hi there, just a quick one.... I am trying to write a View in SQL Server that originated from an Access Query. The problem i am having is using criteria in the view, relating to a column value - Column Table Criteria Or vchrChannel tbl...more >>

Urgent: Create csv and upload thru ftp server
Posted by Ashish Kanoongo at 1/15/2004 4:06:04 PM
Hello There I want to generated a csv file from sql server table, in which I would = like to create a asp page which display a field list with a check box. = Then whatever check box I selected, and click on generate button, then a = CSV text fill will generate depending on sellected field with...more >>

Availability check problem
Posted by AndrewM at 1/15/2004 4:00:51 PM
Hello everyone, I need to do an availability check based on a date period. I have a table which holds two lots of availability. 1. The available period 2. The unavailable days within the available periods. The available periods are tagged by a "0" in the stopStart column. The unavailable...more >>

Stupid problem with money datatype
Posted by Stuart Davis at 1/15/2004 3:36:24 PM
Using SQL Server 7, SP4, Windows server 2000 SP4 I have a weird problem with values stored in our production SQL server. Simplified, I have the following table: create table orderitems (orderid int not null,barcode varchar(13),rrp smallmoney) In Query Analyzer, the following query: "sel...more >>

Programming SQL Server "Yukon" SMO in VB.NET
Posted by Kapil Joshi at 1/15/2004 3:01:13 PM
Hi ! I am trying to connect to the sqlserver "yukon" instance on my local machine using the foll. code ... ---------------------------------------------------------------------------- ------------------------------------------------------------------- Public Function doConnect() A...more >>

Constraint error
Posted by James Dupont at 1/15/2004 2:41:17 PM
I deleted records in a table. I used Truncate table to delete the records in the table because I wanted to restart the Identity column number assignment. But after I did this what I get. Additional information: Column 'tblRedRiver_CDR_PK' is constrained to be unique. Value '1' is already prese...more >>

finding max records per "group"??
Posted by Microsoft at 1/15/2004 2:40:45 PM
My data looks like this: ID SEQ1 SEQ2 AMT 1 1 1 20 1 1 2 10* 1 2 1 50 1 2 2 00* 1 3 1 08 1 3 2 30 1 3 3 ...more >>

format number
Posted by culam at 1/15/2004 2:38:39 PM
Hi, How do I format the below number to a more readable format. 4516785 into 4,516,785 Thanks, culam...more >>

Result Sets vs. Output Parameters
Posted by myron schroner at 1/15/2004 1:56:16 PM
We've recently experimented with using output parameters instead of result sets, and we're seeing unexpected results. Our test sproc returns about 20 values, which we turned into output parameters, and this caused our processing to drop from 400 batches per second to 135. The slowness doesn't se...more >>

Delete duplicate row?
Posted by Steve at 1/15/2004 1:52:18 PM
Greetings, I need to delete a duplicate row, a row with one duplicate field but with a second field that is less than the second field of the duplicate row. CREATE TABLE [dbo].[tbl1] ( [fld1] [nvarchar] (1), [fld2] [int] ) Insert Into tbl1(fld1, fld2) Values('A', 1) Insert Into tbl1...more >>

Problem with transactions and Identity col
Posted by AussieRules at 1/15/2004 1:41:50 PM
Hi, I have a VB.NET app that writes data to a series of tables with a transaction. The transaction functionality is new, the code operates fine outside the transaction scope. The problem seems to be that when the VB code executes outside of the transaction scope, it works. The very first...more >>

Filtering records by the earliest date value
Posted by Matthew Leiderman at 1/15/2004 1:26:25 PM
Hello I have the following view in a SQL Server database SALES_OPPORTUNITY_ID CREATE_DATE CAMPAIG 1 1/1/2003 We 1 1/10/2003 Telemarketin ...more >>

Joining a table where the name is pulled in from a query - Possible?
Posted by Joe at 1/15/2004 1:09:38 PM
Hi. I have a problem that I'm hoping someone can help me with. I'm needing to pull data from a table, but at design time of the query I don't know the name of the table. For instance lets say I have a table like the following Categories id name tablename ---------- -------------- -...more >>

Average Age
Posted by Gerry Viator at 1/15/2004 12:58:32 PM
Hello all, I get the age using this, I would also like to get the Average age of the result age Column? select dob, datediff(year,dob,getdate()) - case when 100*month(getdate())+day(getdate()) <= 100*month(dob)+day(dob) then 1 else 0 end as Age from tmpesc ...more >>

Trigger
Posted by Ben at 1/15/2004 12:56:44 PM
Hi: I am very new in SQL Server. I am using VB6 to insert values into my table in SQL Server. I like to create a Trigger for my table that will not allow duplicate values being inserted into the table. The primary keys are: FirstName LastName Phone Any help to create this trigger will be ap...more >>

Howto UPDATE within a function
Posted by Bernd Maierhofer (dato) at 1/15/2004 12:28:27 PM
Hello, I have some sql statements which make use of functions: select a, b, fn_c(a) from xy fn_c calculates a value from a table. I want to optimize this by first calalculating the value as usual, but additionally I want to save the value to a table, so subsequent calls of the function ca...more >>

substring help
Posted by F HS at 1/15/2004 12:21:01 PM
Hi, declare @var varchar(100) set @var = '120000-004721-002198-0507' what is the sql to break down the whole string into 4 columns each of one would be separted by '-'. so the result for the above example would be: A = 120000 (length= 6 ) B = 004721 (length= 6 ) C= 002198 (l...more >>

New B question
Posted by Geo at 1/15/2004 12:11:21 PM
Is it possible to use a loop to copy items from column-A to column-B in the same table? Thanks in advance. Geo ...more >>

tough date format conversion
Posted by joe at 1/15/2004 12:07:03 PM
how do i convert following date to this format? 2004-01-15 11:13:43.000 ---> 01/15/04 12:59AM ...more >>

Pass a Field from Table to UDF as parameter
Posted by Frank at 1/15/2004 12:06:33 PM
Hi al I am wondering if it is possible to pass a database field as a parameter to UDF.. Normaly I use UDF like SELECT * FROM somefunction('teststring' In a SELECT Statement with some joins etc. I use also a UDF and I would lik to pass a db field like (tablename t) --> somefunction(t.Fld_Date ...more >>

Update Linked server table with inner join
Posted by Cornmen at 1/15/2004 11:54:25 AM
Hello, I'm wondering if its possible to update a linked server when the update query has an inner join with an sql table. Any ideas would be appreciated, the sql update query is below. update [accesstable] inner join [sqltable] on [accesstable].id=[sqltable].id set [accesstable].testfiel...more >>

Difference
Posted by QQ at 1/15/2004 11:51:14 AM
what exactly is the difference between a clustered index scan and clustered index seek?...more >>

Get trigger's table name
Posted by Dolphin at 1/15/2004 11:50:45 AM
Hi, Can I get trigger's table(s)name? Example: --************************************************ CREATE TRIGGER TBL1_INSERT ON dbo.TBL1 FOR INSERT AS DECLARE @TABLE_NAME varchar(128) .... --************************************************ In this case I want set @TABLE_NAME = 'TBL1'...more >>

Where can I find the table of the errorcode ? eg: 2627 = "duplicate key".
Posted by Ang at 1/15/2004 11:41:20 AM
Thanks....more >>

Total count and Sum
Posted by culam at 1/15/2004 11:39:03 AM
Hi, I have a query below that do the count for each source code in my where clause. My next step is to calculate count and Sum(amount) for each group. Example Group 1:Source in 'satd','satf','sati','satw','acha','achb' Group 2: Source in('atmp','debp','dedx', 'patd','patf') Group 3: Sourc...more >>

Insert Into tbl2 Join tbl1?
Posted by Steve at 1/15/2004 11:10:11 AM
Hi, I need to copy missing records in a dest table from a source table - both tables are alike and both contain the same data except that tbl2 is missing some records that exist in tbl1 - they need to both have the same amount of records - how to populate missing records in tbl2 in one ...more >>

All Diffrences between table datatype and temporary table
Posted by Anitha at 1/15/2004 11:01:13 AM
Please tell me all the differences between table datatype and temporary table....more >>

SQL Books
Posted by at 1/15/2004 10:58:43 AM
Can someone suggest good MS SQL Server books on the programing side (DTS, Triggers, Stored Procedures...)? And then a good Adiminstration book as well? Thanks ...more >>

Difference running stored procedures in Win NT & Win XP???
Posted by Damon at 1/15/2004 10:45:29 AM
I have a stored procedure within my app which works perfectly when running my VB6 app from Windows NT, however I have now had to move my project over to Windows XP. When it gets to a certain point where it needs to open up a recordset relating to this certain stored procedure it just exits my ap...more >>

Standard Deviation
Posted by Abraham at 1/15/2004 10:40:04 AM
Is there any way in SQL Server to use Standard deviation as an aggregate function. STDDEV -- Is a numeric expression. Aggregate functions and subqueries are not permitted Thanks ...more >>

Problems using TSQL debugger in SQL2000
Posted by Carlitos at 1/15/2004 10:29:46 AM
Hi there, We have always used the TSQL debugger in the Query Analyzer. Nevertheless, we have installed a new instance of SQLServer and the debugger seems not to work properly from a client when debugging SPs in the new instance. What it does is that you launch the debugger for the selected S...more >>

SP that has optional Param
Posted by JDP NO[at]SPAM Work at 1/15/2004 10:12:46 AM
Is there a way to script a proc to optionally not pass a parameter? I want to impelment a new version of an SP. The sp is a wrapper for an XP. The xp is xp_NewRecID, for that reson it lives in the Master db, however due to performance hits and errors on the main db server I've moved the xp ...more >>

Retrieve top 3 most recent dates from a table
Posted by Troy at 1/15/2004 10:10:01 AM
I am attempting to pull the top 3 most recent dates from a table (from a date/time field called stamp) and I am having a little trouble getting the values. Here is the query that I am using.... select distinct top 3 rtrim(ltrim(str(datepart(month, stamp)))+'/'+ltrim(str(datepart(day, stamp)))...more >>

Null in indexes vs.performance
Posted by Stefan Turalski (stic) at 1/15/2004 10:03:54 AM
Hi, I have to ;-) wonder about that case: I have quit a big tab with have over 1,400,000 rows each of about 30 columns. One row is for example CaseName with is indexed, nonclustered and is nvarchar(255) as a new type TName, with is NOT NULL. This column is also nullable - what do you say abo...more >>

Problems with SQLXML 3.0 Bulk Load
Posted by hagchr NO[at]SPAM start.no at 1/15/2004 9:54:03 AM
I'm having some troble inserting the data from a XML file to my SQL Server 2000. I've created a XML-Schema, and a VBScript that creates a SQLXMLBulkLoad objekt and inserts the XML data into the database. When I execute the script I get no errors, but the data is still not coming into the da...more >>

CPU resources
Posted by Vincent at 1/15/2004 9:37:49 AM
When I run a stored procedure, it use up 100% CPU time for a long time. I have two databases for two departments. One is suffer from the sharing of CPU time. Can anyone help me. Thanks a lot ...more >>

technotes and remote access
Posted by woodysapsucker at 1/15/2004 9:32:45 AM
Mike, I haven't received any information back from the Microsoft sqlServer newsgroup on how to get the text field working so I'm going to reprogram things to use external files for the technotes unless you have a problems with that. I'm going to save files within the web directory structure. T...more >>

LIKE Comparisons?!
Posted by Amy Snyder at 1/15/2004 9:30:12 AM
I am using this code and confused as to why some results are being returned Select * From Table1 Where Field1 LIKE 32[11-22]% Why would I get a result back where the field is '332913' and '332510' *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in US...more >>

Please help: Creating a table in a sql server database
Posted by paulsmith5 NO[at]SPAM hotmail.com at 1/15/2004 9:27:41 AM
Hi, I wish to be able to add tables to a sql server database at runtime from my asp.net application. As well as creating fields I also wish to be able to create indexes on selected fields and to assign user permissions. (I need to assign permissions to the table object as I will be using sp_e...more >>

Reporting Services download?
Posted by Brian Bischof at 1/15/2004 9:26:10 AM
I want to check out the Reporting Services for SQL Server. Can someone point me to the download (if there is one) or any whitepapers? Thanks. Brian ...more >>

SQL server identities are non sequential
Posted by ..:::M:O:R:B:I:L:L:O:::.. at 1/15/2004 9:16:39 AM
Hi to all I've a great problem with sql server 2000. The identitity field of a table is not sequential, but jump, in some cases, between crescent number non sequentially. May you hel me ? the question is very urgent MORBILLO ...more >>

Find Max Amt with Corresponding Date
Posted by Lynn at 1/15/2004 8:51:52 AM
I am trying to return a max amount with the corresponding date. The problem is due to the one-to-many relationships the max amount gets returned but if there are more than one amount/date then I get the max amount returned multiple times. For example, John Doe as 3 records. 25,000 01/...more >>

Conditional inside of SQL
Posted by Sean at 1/15/2004 8:18:01 AM
I am doing an Outer Join between two tables on an ID number, and I'm trying to do a conditional statement inside my query such that if there is a matching row, I set a column as a name (e.g. InnerTable.Match as MyCol), but if there isn't a matching row, I set a column in my Outer table as ...more >>

limit the result of 'sp_columns'
Posted by TimManns at 1/15/2004 8:14:29 AM
Hi, I'm using sp_columns to return a list of columns. I want to limit the result to only the column names. Any ideas? Tim - More info- I'm building a VB .NET application that queries my database and dymanically fills in combo boxes with the database info (table names, then column...more >>

SQL
Posted by Peter Newman at 1/15/2004 7:43:52 AM
I have three tables. all linked by fieldLicence I need to find out which licences do not appear in all tables Ie Licence Table1 Table2 Table3 111111 YES NO Yes 212121 NO NO Yes ...more >>

put web data to temp table
Posted by blarfoc NO[at]SPAM yahoo.com at 1/15/2004 7:31:50 AM
hello! i will to write a stored procedure that will download a csv file from a http url like this http://www.web.com/file.csv i want to put those csv datas in a temp table or real table it does'nt matter. how do i go about this? AP!...more >>

Trapping Primary key integrity errors.
Posted by Peter at 1/15/2004 7:28:34 AM
Dear All I have a store procedure which will insert records. Lately we have had an incident where the next id for indentity fields were spoilt so we were getting integrity constraint errora, The SP should of tripped it and sent a note off to a table. The code is as follows... DECL...more >>

Should I Loop? Or any other SQL Suggestions
Posted by Steveo at 1/15/2004 7:18:53 AM
This is a select statement to find each row where it does not exist in the next period of the same year. eg This exists in the table Year Period Cost_Centre Account 2003 1 G3565 A1111 BUT 2003 2 G3565 A1111 Does not. So the select statement 'creates' the missin...more >>

Taking Values from List, and Inserting into Individual Rows
Posted by lroberson NO[at]SPAM myway.com at 1/15/2004 6:55:58 AM
I'm looking for a way to take a list of values (comma separated) from an ASP Text Form, and have them added as individual rows of a table. For example, if a person selects four colors, I want each ColorID to be added as it's own individual row....more >>

date only...
Posted by Roz at 1/15/2004 6:27:11 AM
Folks, I'm sure this has been asked before. But, is it possible to INSERT only the date into a smalldatetime or datetime field. When I try it, SQL Server inserts the time as well. I only want to insert the date. Using SQL 2K. Thnx Roz ...more >>

moving report generation logic to sp
Posted by AjayT at 1/15/2004 5:38:45 AM
Hi All, I have a requirement of moving report generation logic from c++ code to a strored procedure in sql server 2k. Report is generated as follows in c++ code. Begin Open AdvReportRS() For each record in AdvReportSetRS Open activeCarrSetRS() For each record in activeCarrSetRS ...more >>

Help !!!
Posted by amitb NO[at]SPAM zenithinfotech.com at 1/15/2004 4:27:01 AM
Hello all, I have table named TableA Entity : TableA Fields : Srno int Name varchar(20) There are existing 10 records in TableA. Now i want to know when i.e. DateTime these record where created in SQL Server 2000 Database. Does SQL Server maintains internal log of datetime whe...more >>

Bulk Insert
Posted by kkr at 1/15/2004 3:24:14 AM
Hi there When I tried to execute the following line in query analyzer on my local database BULK INSERT table1 FROM 'C:/folder1/filename.txt' WITH (FORMATFILE = 'C:/folder1/filename.fmt' ) It gives me the error: Server: Msg 4861, Level 16, State 1, Line 1 Could not bulk insert because...more >>

Restore the data
Posted by Fatboycanteen at 1/15/2004 3:11:17 AM
If I Updated some data to a table, and want to restore the old data How can I do?? Thank You...more >>

Dynamic query
Posted by Durai at 1/15/2004 3:07:11 AM
hai, I need to write a select query in the following way select date from employee where empaction ='HIRE' and date between 15-01-2004 and 14-12-2003. here the date field should be dynamic ,i have to compare the date with sysdate and fetch the data according to that can anyone help on th...more >>

Red alert
Posted by Phuoc Linh at 1/15/2004 2:21:10 AM
Hardware includes: IBM server x220, PIII, 1.2 GHz, Xeon, HDD 36 GB, RAM 1 GB. Software includes: Operating System: Windows 2000 server; Database server: MS SQL 2000 standard edition server. Application includes: developed on VB Script, ASP technique. 10 modules having about 1500 files each (15...more >>

Problem setting 'dbo use only' option on SQL Server 2000
Posted by Kamran Kazemi at 1/15/2004 1:46:15 AM
Hello everyone I am having problems on setting 'dbo use only' option for a database on SQL Server 2000. I have a VB6.0 application that connect to a database using 'sa' as userid and then executes the following configuration commands (in that order) through a DSN 1) EXECUTE sp_configure 'allo...more >>

using multple databases effeciently
Posted by Hugo at 1/15/2004 1:16:10 AM
I need to access multiple stock databases using the same tables from one main database (company). How will this function perform with a large (300000+) number of stock items in about 10+ warehouses. Is there an alternative way of doing this. I DONT want to use EXEC('') !! Thank you ALTER FUNCT...more >>

SQL Cursor...any faster alternative
Posted by Mike Rhodes at 1/15/2004 12:38:25 AM
I'm using a cursor in sql 6.5 to transfer 4million records from one table to another with checkpoint so that the log doesn't fill up and doesn't need to be unecessarily big. Problem is it's taking 5 hours!...anything quicker I can use?...more >>

Locking an entire table within a stored procedure
Posted by John at 1/15/2004 12:10:12 AM
Forgive me for asking a question that gets asked a lot, but I don't know where the archives of this list are stored. Is the following code the best way to lock a table in a stored procedure while I do other queries on the locked table and other tables ? If I use a table hint of "TABLOCKX" w...more >>

indexes and indices
Posted by ram at 1/15/2004 12:08:47 AM
I am a newbee and want to know what is the diff. between indexes and indices. Help appreciated. ...more >>

dts vs sp
Posted by tuning at 1/15/2004 12:07:24 AM
I have some which can be done by DTS as well as with SP, I just want to know which is faster among sp and dts. ...more >>


DevelopmentNow Blog