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 > february 2004 > threads for wednesday february 18

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

Append vs Make Table - Total Record Limits?
Posted by Michael Franzyshen at 2/18/2004 11:16:05 PM
I have a customer that upsized an Access 2002 application to a SQL2000 server. One of the converted make table queries which ran fine in Access 2002, now stops after writing 10,000 (10K) records to the new table (on SQL2000). Has anyone else experienced anything similar to this? We found if we ap...more >>


getting a column from an inserted row on trigger event
Posted by Brian Henry at 2/18/2004 10:58:58 PM
When a trigger even is called for insert, how do you get the value of a certain column of the row that was inserted? thanks! ...more >>

concept
Posted by srinu at 2/18/2004 10:36:06 PM
is there any concept in sql server like ( Injunction or Ingestion) . if so what is this ... thanks. ...more >>

Help Please -- ADODB.Command does not work correctly in .NET
Posted by ivanfernandes NO[at]SPAM flashmail.com at 2/18/2004 9:59:52 PM
Hi all, i have been trying this for 7 hrs now !!! How do you call a adodb.command object in .net(c#) code****** ADODB.Connection cn = new ADODB.ConnectionClass(); ADODB.Command cm = new ADODB.CommandClass(); ADODB.Parameter pa = new ADODB.ParameterClass(); ADODB.Recordset rs = new ADODB....more >>

SQL Server Client
Posted by Prabhat at 2/18/2004 9:37:16 PM
Hi All, How DO I know if the SQL Server Client is Installed in a PC or not using any program like VB/Delphi? As My Application (Running in a System where SQL Clinet not installed) able to Connect to SQL Server Database Running in Different System and also able to retrive data but not able t...more >>

Make an update into one query
Posted by Adrian at 2/18/2004 9:35:05 PM
Using SQL Server 2000 For example I have a table called Products with columns ProductID, ProductName and TotalCost. I have a second table called OrderDetails with columns ProductID and CostOfOrder. There would be multiple orders (rows) for the same productID. I want to update the TotalCos...more >>

Joining two tables
Posted by Benny at 2/18/2004 9:22:45 PM
Hello Experts, Assumping I have two tables: Table 1 with fields: customer_id name age 1 James 20 2 Andy 19 Table 2 with fields: customer_id description 1 Hello world ...more >>

BULK COPY changes row order importing Text file
Posted by Víctor Hugo Ulloa Meléndez at 2/18/2004 8:56:45 PM
Hi everyone: We're importing a text file using a BULK COPY sentence like this: BULK INSERT tbWFTextFile FROM 'c:\tempo\prueba.txt' tbWFTextFile is a table that has only 1 field named fldLine VARCHAR(255). The problem is that we need later to know the exact line number of the text file t...more >>



REQ: How to create a Sort Order Col on the fly?
Posted by Rick at 2/18/2004 7:36:29 PM
-- Below is a query being used in a view... USE NORTHWIND; SELECT TOP 100 PERCENT [CompanyName], [ContactTitle], 1 AS sortOrder FROM [Northwind].[dbo].[Customers] ORDER BY contactTitle, companyName; /* OUTPTUTS CompanyName ContactTitle sortOrder -----------...more >>

Heterogeneous queries error
Posted by kriste at 2/18/2004 7:22:12 PM
Hi, I've a dynamic query that works on linked server but it keep giving me = this error "Heterogeneous queries require the ANSI_NULLS and = ANSI_WARNINGS options to be set for the connection. This ensures = consistent query semantics. Enable these options and then reissue your = query."=20 ...more >>

Heterogeneous queries error
Posted by kriste at 2/18/2004 7:18:05 PM
Hi, I've a dynamic query that works on linked server but it keep giving me = this error "Heterogeneous queries require the ANSI_NULLS and = ANSI_WARNINGS options to be set for the connection. This ensures = consistent query semantics. Enable these options and then reissue your = query."=20 ...more >>

cursors in stored procs
Posted by Maurice Telkamp at 2/18/2004 6:30:51 PM
Hi all, (MS SQL 2000) I need to declare and populate a cursor in procedure A, and use that cursor in procedure B. It seems I'm only able to declare the cursor in procedure A, and populate it in procedure B (which is not what I want...) Is it possible to use a cursor declared and populate...more >>

Update multiple table columns using subquery
Posted by Eric W. Holzapfel at 2/18/2004 6:09:47 PM
Hello SQL newsgroup, Is there a way that I can update more that one column at a time using SQL (in this case MS SQL 2000) I can use sql like the stuff below to update 1 column. I would like to be able to update 3 columns at once in a table with data from another table. I have yet to figur...more >>

Example of stored procedure with OUTPUT parameter of type TEXT
Posted by Angel Anichin at 2/18/2004 4:51:53 PM
Can someone provide and example of stored procedure that can return TEXT or NTEXT ? MSDN says it is possible but no example is provided: >OUTPUT >Indicates that the parameter is a return parameter. The value of this >option can be returned to EXEC[UTE]. Use OUTPUT parameters to return...more >>

Convert VarChar to Date
Posted by Scott at 2/18/2004 4:28:26 PM
I'm trying to convert a varchar(50) field to Date field like below. For compatibility reasons, I need to keep the month and day in 2 digits and convert the year to 4 digits. I'm horrible at dealing with strings, can someone help? I inherited this problem and can't start working on this db befo...more >>

Linking
Posted by warway at 2/18/2004 4:21:03 PM
Is it possible to link to an ODBC data source from a MS Access project. I want to link to another set of tables that contain accounts information that will be associted with records in the .adp file. Andrew andrew@dii.co.uk ...more >>

triggers
Posted by Brian Henry at 2/18/2004 4:15:30 PM
I have a table (accounts), and a stored procedure that creates items in another table based on the accountID from the accounts table, how would i make a trigger to for each accountID (identity column) insterted into the accounts table create the items using the stored procedure on the other tabl...more >>

Not exists performance problem...
Posted by Jéjé at 2/18/2004 3:59:27 PM
Hi, I've a query to load my data warehouse, like this : select C1, C2, C3.... from T1 inner join T2 ...... where not exists (Select * from FT1 where FT1.A = C1.A and FT1.B=C2.B...) my T1 table (the biggest one) has 240 000 records my FT1 contain only 20 000 records. the result is near 1...more >>

Is this a hack?
Posted by DaveF at 2/18/2004 3:37:24 PM
I have a products table that records the value of 3 attributes for each product: name, class and price. The products are divided into 2 classes: 'a' and 'b.' I need to return a result set with 4 fields: the name and price of the highest priced 'a' product and the name and price of the highes...more >>

Naming Conventions
Posted by Max André Bündchen at 2/18/2004 3:23:36 PM
Hi all! In the internet, we can find much material of naming conventions. However, I can't find any material of realistic use. Anyone has a nice naming conventions system for SQL Server or another DB Server with similar sets? Thanks for all. Max ...more >>

converting datetime to unix datetime
Posted by SQL Apprentice at 2/18/2004 3:19:42 PM
Hi, I wrote a script to convert a unix datetime (1072944000000) to a readable datetime (2004-01-01 08:00:00). use northwind select CONVERT(VARCHAR(20),DATEADD(s,CAST(1072944000000 as BIGINT)/1000,'19700101'),120) result: 2004-01-01 08:00:00 I am having problem going backward...ca...more >>

Nested Model
Posted by Robert Taylor at 2/18/2004 3:00:37 PM
Okay Joe, I know you're lurking around here somewhere. I'm trying to convert an adjacent model table to a Nested Model using one of Joe Celko's scripts. I've modified Joe's code to work with SQL, but I don't get the expected results. When I look for a manager who only should have 3-4 subor...more >>

Pass string of comma seperated values for IN clause
Posted by DM at 2/18/2004 2:35:22 PM
Is there any way to pass in a string of comma-seperated values to a stored procedure for use in an IN clause withut having the entire string parsed as a single value? Specifically, I want to get all employees who do not have an EmpStatus equal to one of the values I pass to the stored procedur...more >>

Making a string XML-Friendly ?
Posted by Martin Crimes at 2/18/2004 2:18:33 PM
I have a varchar column in a table which contains a series of text descriptions, which contain many of the characters such as &, < and >. The contents of this table is later turned into very simple XML with string concatenation later on in a stored procedure. All the code for this application ...more >>

retrieve value of output parameter from Stored Procedure
Posted by Gerald Roston at 2/18/2004 1:39:26 PM
Here is a snippet of my ASP.NET application: Dim UserID As Guid Dim cmdAddUser As New SqlCommand("sp_AddUser", myCon) cmdAddUser.CommandType = CommandType.StoredProcedure cmdAddUser.Parameters.Add(("@Add"), bAddUser) ' boolean - 1 add, 0 - update cmdAddUser.Parameters.Add(("@UserName"), st...more >>

How do I post getdate() function in text box (asp.net)
Posted by culam at 2/18/2004 1:33:21 PM
Hi, I am building a intranet application, and the users want to see the timestamp and then log it in the table. How do I post the getdate() function to the text box. Thanks, Culam...more >>

BLOB
Posted by Joe at 2/18/2004 1:27:07 PM
Could someone tell me how you insert images from a file into a table? Any help is appreciated. Joe...more >>

Query performance: order of joins/wheres...
Posted by William Morris at 2/18/2004 1:25:55 PM
SQL Server 2000 Windows 2000 Business Server DDL (Much simplified) Table: tblPeople Lastname varchar(25) Firstname varchar(25) CompanyID int Let's say that tblPeople has 500,000 rows, unevenly divided between three companies: 1, 2, 3. Company 1 as 10,000 rows, Company 2 has 90,000 rows,...more >>

Dynamically drop and create FKs
Posted by Mo at 2/18/2004 12:58:37 PM
Hi, I need to drop foreign key constraints everyday from my database. My question is how do I generate the drop constraint script dynamically from sysobjects ? Also i want to put this in a stored procedure like this create procedure drop_all_FKS as ( EXEC ('select 'ALTER TABLE ',obje...more >>

Syncronizing SQL Servers in t-sql code
Posted by Lars Grøtteland at 2/18/2004 12:58:03 PM
Hello! Can anyone help me please. I have several database and I would like to synchronize all of them from one "Master" database. I'm not talking about the data in the database, just the field size, tablename, and so on. How do I do that? Any answers would be greatly appreciated - L...more >>

DbLib and Oracle (?)
Posted by Daniel P. at 2/18/2004 12:57:49 PM
Sorry to post this here but I did not find any DbLib dedicated newsgroup: I have a C++ (MFC) app that uses DbLib to connect to MS SQL Server. Is it any way I can make work with Oracle? Thanks! Daniel PS My feeling is that it is not possible, but I need to double check that. ...more >>

Sybase VS M$ SQL
Posted by Joe at 2/18/2004 12:38:30 PM
I was pushed into a demo to our business are to explain why moving to M$ SQL from Sybase is such a good move. I'm struggling for ideas to elaborate on - I'm a programmer not a presentation person. Anyone got lots of good ideas why it's better to be on M$ SQL? -- __________________________...more >>

TRANSACTION ERROR
Posted by harsh at 2/18/2004 12:10:35 PM
I have the following code begin transaction test some inserts set @Error=@@error if @error=0 begin some updates set @error=@@error end if @error =0 begin commit transaction test end else begin rollback transaction test end now if there is some error in the execution like ...more >>

SQL server create table from client fails
Posted by cpoint at 2/18/2004 12:01:05 PM
Hi I am no expert on SQL server as of yet. I have a database created server (win2000). I can access, create do anything under the sun without problems on this server to this database. I have a second pc (client - windows xp). Has similar setup and sql server as well. Again on this pc i can cre...more >>

delete next to highest value in table?
Posted by Rich at 2/18/2004 11:49:28 AM
Hello, Here is my design and sample data and what I need to accomplish: CREATE TABLE [dbo].[tbl1] ( [val1] [int] NULL , [val2] [int] NULL) Insert Into tbl1(val1, val2) Values(12, 7) Insert Into tbl1(val1, val2) Values(10, 7) Insert Into tbl1(val1, val2) Values(9, 8) Insert I...more >>

Count Distinct Items
Posted by highway8088 NO[at]SPAM yahoo.com at 2/18/2004 11:48:17 AM
Hi, I have a table samilar to the following. I would like to count the number of total distinct items in Column 2. But if the same item appears in more than 1 group in Column 1, it should be count as many times as it shows up in different column 1. For the sample following, I am expecting an ...more >>

Alert Interegation
Posted by Dave Ainslie at 2/18/2004 11:22:35 AM
Hi, I am trying to create an email alert using xp_sendmail which when invoked will send me back the table name that has just caused a duplicate key violation. Does such a table exist? Any Ideas? Thanks Dave ...more >>

simple select statement with case not working
Posted by DC Gringo at 2/18/2004 11:21:34 AM
I have a simple select statement using a CASE to convert a null to 0. The returned record set still gives me null... help? SELECT clnPopulationCensus = CASE s1.clnPopulationCensus WHEN null THEN 0 END FROM tblSurvey1 ____ DC G ...more >>

Grouping
Posted by Scuba79 at 2/18/2004 11:16:05 AM
I have a table that contains two datetime fields, PDate and VDate. I need to group and count those two fields by hour I need a total count of PDate by hour and then a count of VDate, if VDate is within the same hour as PDate but is not counted in the next hou Example Table PDate ...more >>

Order by clause...
Posted by Yaheya Quazi at 2/18/2004 11:14:01 AM
Hi I want to dynamically pass in a order by field name into my stored procedure....is there any other way but to use dynamic SQL to pass in the order by field name to my select statement? Thanks....more >>

removing IDENTITY attribute
Posted by TJTODD at 2/18/2004 11:08:20 AM
If I have a table with an IDENTITY column, is there any way to alter it to remove this attribute? Thanks! ...more >>

Problem with precision with decimal value
Posted by Ale at 2/18/2004 11:02:07 AM
I have this problem.... declare @uno decimal(24,12) declare @due decimal(24,12) declare @tre decimal(24,12) set @uno=123456789012.123456789012 set @due=3 set @tre=@uno/@due RESULT: 41152263004.041152263004 and using another declaration declare @uno decimal(38,12) declare @due d...more >>

Increasing performance of query using a bit field
Posted by JerryK at 2/18/2004 10:54:00 AM
Hi, I have a Stored proc that has a query that uses a bit field. When I run the query the Execution Plan shows that the 200,000 rows are read in processing the bit match. Since I cannot put an index on a bit field, how I can increase performance? One thought was to switch to tinyint, but ...more >>

Direct query vs Query in a stored procedure
Posted by Abhishek Srivastava at 2/18/2004 10:19:52 AM
Hello All, Is there a difference in the way SQL server returns data to the client applictions (vb, c#) when they directly execute an SQL as compared to when the same SQL is put in a stored procedure? I know about execution plans etc. but I am asking from a point of how the data is return...more >>

Wrapping Extented Procedure in UDF returns null
Posted by nfalconer at 2/18/2004 10:12:38 AM
I have an extended procedure which receives two float inputs and returns a varchar(20). This is a sample of how it's called and it works correctly in this format: ----- declare @retval varchar(20) declare @x float declare @y float set @x = 12.0 set @y = 11.0 execute master.dbo.xp_myExten...more >>

Triggers and Deleted table
Posted by Star at 2/18/2004 10:01:36 AM
Hi I have a trigger like this: CREATE TRIGGER [TRIGGER_Call_DeleteRecordCascade] ON [dbo].[Call] FOR DELETE AS SET NOCOUNT ON DECLARE @cCode nvarchar(255) select @cCode = Code from Deleted exec sp_Subs_DeleteRecordCascade 13, @cCode I have noticed that this Trigger works fin...more >>

Backup Database
Posted by André Almeida Maldonado at 2/18/2004 9:38:42 AM
Hey Guys... So... I have to backup my database, and to do it, I'm executing this code: USE master EXEC sp_addumpdevice 'disk', 'backup_folder', 'c:\backup.dat' GO BACKUP DATABASE EVARTE TO backup_folder But I'm receiving the following error: Server: Msg 3201, Level 16, State 1, L...more >>

How to reduce the Log file
Posted by Sharad at 2/18/2004 8:29:48 AM
Dear Friends Please suggest how i can reduce / purge the log file so that the space will be released. Best regards Sharad...more >>

Choosing data types to conserve space
Posted by Steve H at 2/18/2004 7:51:05 AM
I once heard from a developer that there were more instructions required from the Intel processors in order to process data types such as smallint and smalldatetime since they were non-standard. Is this true? I would rather expel the modest amount of disk space than burn CPU cycles if given the ch...more >>

Joining Adjacent Time Intervals
Posted by James at 2/18/2004 7:28:00 AM
How can I join time interval together? With the following table: create table #t (RowId int, BeginDate datetime, EndDate datetime) insert #t (RowId, BeginDate, EndDate) select 1, '1 Jan 2004', '5 Jan 2004' union select 1, '6 Jan 2004', '10 Jan 2004' union select 1, '11 Jan 2004', '20 Jan...more >>

UPDATE statement
Posted by simon at 2/18/2004 7:25:45 AM
I have table narociloIzdelek with 3 columns: nar_id,izd_id,izd_zakljucen. First 2 columns are PK. With select statement I get the values of nar_id and izd_id of the rows, I would like to update: select nar_id,izd_id from (select nar_id,izd_id FROM narociloIzdelek where izd_zakljucen=1)as T1...more >>

how can i debug a scheduled job ?
Posted by guillaume NO[at]SPAM diademe.fr at 2/18/2004 6:45:20 AM
This is about automatic backup task . i want to save Database each day and every three minutes per day.the database (three minutes just for testing) so i use this script : USE msdb EXEC sp_add_job @job_name= 'save', @owner_login_name = 'sa' go USE msdb EXEC sp_add_...more >>

Searching tables for matches with other tables
Posted by Dale Fye at 2/18/2004 6:41:05 AM
I have some data I have been asked to analyze, specifically two tables Log_Events and Tool Log_Events contains a column (Events - varchar(200)) that contains some log dat Tools contains a single column (ToolName - varchar(50)) that contains the names of some of the tools that the program uses I...more >>

Order By with Union
Posted by Manoj Agarwal at 2/18/2004 6:36:11 AM
I have two tables, TableA and TableB defined as follows, TableA A1 int A2 int A3 int TableB B1 int B2 int B3 int If I try to run this query, SQL Server says syntex failed at the Order By clouse. Is such Order by not allowed in SQL, Any other way to achieve th...more >>

Cursor Type
Posted by Mike Randall at 2/18/2004 5:36:12 AM
Hello All I have encountered a small problem when calling a stored procedure from an ASP whereby the cursor type of the returned record set seems to have been changed as a result of the select statement being embedded within an IF statemen within the SP The call to the Stored Procedure within th...more >>

Query Statment is Fast But Stored Procedure is Slow
Posted by San at 2/18/2004 5:26:10 AM
Hi, Suddenly one of our stored procedure become dead slow. But if we execute all the sql statement in query analyser, we are getting the result within one second. In a production environment we have to use the same stored procedure. We can not avoid the stored procedure. Pls help me. Than...more >>

Using expressions AS a select clause
Posted by J Jones at 2/18/2004 5:14:13 AM
I saw an earlier posting regarding using expressions in a select clause. That got me thinking that maybe it is possible to use expressions to select rows. I have a field in a table containing expressions like: (A > 31 AND B <= -8) Could I declare values to A and B and then evaluate the expressi...more >>

StoredProcedure vs. Recordsets
Posted by Anubis at 2/18/2004 3:48:27 AM
Hello, I'm trying to determine which of the following options would better suite my application. I am needing to retrieve information from my SQL server at specific points in my ASP application. Which of the following methods would suite my situation better / pros/cons of each, and or perf...more >>

convert varchar to int
Posted by fredrik.soderlund NO[at]SPAM profdoc.se at 2/18/2004 2:54:06 AM
Hi all, This is what I got: Table Order OrderId varchar(15) OrderName varchar(30) select OrderName from order where OrderId = '1050UQA' returns 'FirstOrder' This is want I want to do: select OrderName from order where cast(OrderId as int) = 1050 returns 'FirstOrder' I wan...more >>

UPDATETEXT on memory tables
Posted by Paulo Morgado at 2/18/2004 2:39:53 AM
Hi all I need to add text to a text column in a temporary table. I thougth of using an in memory temporary table (declare @tmp_tab table ...) I have no problem with: select @ptr = TEXTPTR(text_column) from @tmp_tab where <cond> But, when I use: UPDATETEXT @tmp_tab.text_column @ptr ...more >>

Copying TEXT columns
Posted by Paulo Morgado at 2/18/2004 1:03:34 AM
Hi all I need to insert in second table some values that are in columns of the first one. How can I do that when there's a TEXT column? Thanks Paulo Morgado ...more >>

Getting the most recent date
Posted by Shahzard at 2/18/2004 12:46:05 AM
Hi, I want to know how to write a SQL Query to get the most recent date from Date Column/field? Thanx, Shahzard...more >>

Joe Celko's work with nested set models - update times??
Posted by AFN at 2/18/2004 12:41:52 AM
Mr. Celko wrote a great nested set article at: http://www.intelligententerprise.com/001020/celko1_1.jhtml My question is about speed/performance. Suppose there are 200,000 people in the "personnel" table Suppose you want to add a new child under a (previously childless) parent. The parent...more >>


DevelopmentNow Blog