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
August 2008


all groups > sql server programming > july 2003 > threads for thursday july 24

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

SQL syntax help needed
Posted by Buddy G at 7/24/2003 11:12:14 PM
I want to delete rows in a table based upon when status_final is true in another table. Something like this (using Select to see what the query will pull up) Running SQL Server 7 select * from startstop_dictation_log s Join Accession a ON (s.Accession_no = a.Accession_no) Where a.Status_Fina...more >>

Storing only top 10 records?
Posted by Manish Jain at 7/24/2003 7:16:37 PM
Platform SQL Server 2000/ASP.Net/C#/ADO.Net ------------------------------------------------------ My DataTable has following structure ItemTypeID int ItemID int AccessDate DateTime I want to store only the latest 10 items of each type. I want to delete Record 11 onwards whenev...more >>

ConnectionCheckForData ???
Posted by Oljeg Popovic at 7/24/2003 6:07:32 PM
Hi, I'm working on a Web Service that is working fine, but sometimes I received this SqlException. Error #-2: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. on line 0. Error reported by .Net SqlClient Data Provi...more >>

Table name as parameter in stored procedure
Posted by Juan Romero at 7/24/2003 5:52:33 PM
Hey guys, Im trying to create a store procedure that will perform certain duties on a given table. The table name will be passed as a parameter. The problem is I am not allowed to use the parameter as a tablename, so the following queries are rejected: SELECT #temp.[id] as SForceID, @Table....more >>

xp_fileexist
Posted by Ross Culver at 7/24/2003 5:00:17 PM
Books Online (as well as SQL Server 2000 Black Book) do a lousy job of explaining how to use xp_fileexist. How can I use the returned values of this extended stored procedure? How can I set a variable to the returned value? Thanks, ross ...more >>

Manipulating BLOB's in t-sql
Posted by Craig Harper at 7/24/2003 4:53:41 PM
Hi, does anyone know if its possible in t-sql to manipulate data returned from a table which is larger than the magic 8000 char limit? Am playing with tables where the data is about 10000 chars - so have had to use a blob in the table to store the data, but need to manipulate it in its enti...more >>

NOCHECK CONSTRAINT ALL doesn't seem to work
Posted by Bud Dean at 7/24/2003 4:43:52 PM
Hi, Hope someone can help me out with this. Using SQLServer 2k sp3 I have been trying without success to use the following: ALTER TABLE [dbo].[tblClmCfgFileSpecs] NOCHECK CONSTRAINT ALL ALTER TABLE dbo.tblClmCfgSenders NOCHECK CONSTRAINT ALL Truncate Table tblClmCfgFileSpecs The error...more >>

xp_sendmail: Could not resolve recipient
Posted by Miguel Ramirez at 7/24/2003 3:55:02 PM
Hello All, I am doing a very basic xp_sendmail command but it is getting me the following error message: "Server: Msg 18031, Level 16, State 1, Line 0 xp_sendmail: Could not resolve recipient" I re-check several times the recipient name, changed several times also, but did not work. I...more >>



Recieving Application
Posted by Yaheya Quazi at 7/24/2003 3:15:31 PM
I am building an order reciving system. Typically, I have a table which have among other fields, order number, order line number and quantity ordered fields. I want to record how many items were recived as opposed to what was actually ordered. How can go about building this second table wh...more >>

Newbie Trying to dnamically define data types based on columns
Posted by Eric Phetteplace at 7/24/2003 3:03:29 PM
Hello, I am aware of a way of defining data types in Oracle procedures, and this allows you to change a table's data type and have the procedure dynamically realize the change. The syntax is something like this: DECLARE @Password LoginTable.Password%TYPE So, if the LoginTable's Passwo...more >>

SQL-DMO and stored procedures
Posted by univ0 NO[at]SPAM op.pl at 7/24/2003 2:59:21 PM
Hi, is that possible to call a stored procedure through SQL-DMO? cheers p ...more >>

Sorting a text field
Posted by AMA at 7/24/2003 2:57:19 PM
Hi all, I am hoping that somebody had run into the sorting problem that I am having - which is: I have a coulomn which contains varchar data such as 1,2,3,...,10,..,20,... when I sort it by "ORDER BY" it will shows as 1,10,...,2,20,... Many thanks in advance. ...more >>

If one Stored Procedure returns two recordsets
Posted by guzj at 7/24/2003 2:56:43 PM
How can you programming in Visual Basic to process the two recordsets? ...more >>

Nummerate table records for sorting purpose
Posted by Christian Perthen at 7/24/2003 2:51:38 PM
Hi, I am working on a query that will update records like dept_id sort_index 1000153 0 1000155 0 1000156 0 1000160 0 1000161 0 to dept_id sort_index 1000153 1 1000155 2 1000156 3 1000160 4 1000161 ...more >>

Loops within stored procedures
Posted by Shane at 7/24/2003 2:29:03 PM
Hello everybody, I wonder if someone can advise me on how to pass parameters to a stored procedure that come from another query/stored procedure. I am trying to pass a member's of staff's initials as a parameter. The first recordset returned therefore will be something like: Initials S...more >>

Easy question I'm sure
Posted by Ben at 7/24/2003 2:23:06 PM
How can I take 3 columns from one table that are related by one ID and insert them into a single column, but individual rows in another table ex. begin: int1 int2 int3 CompID 1 2 3 15 result: int CompID 1 15 2 15 3 15 Is it jus...more >>

extended stored procedures and T-SQL OLE automation API
Posted by univ0 NO[at]SPAM op.pl at 7/24/2003 2:00:46 PM
hi, which versions of SQL Server support extended stored procedures and the T-SQL OLE Automation API?are they supported on SQL Server 6.5 and 7? cheers p ...more >>

Percentage calculation
Posted by Rajah Venkata krishnan at 7/24/2003 1:32:37 PM
Hi, I am tring to calculate percentage for a given two numeric or integer values. If possible the output should have '%' sign with it. Is there any function for this? If we need to write a function for this, how do we include '%' sign with the output? Any help would be very much apprec...more >>

datetime
Posted by Max Headroom at 7/24/2003 1:24:05 PM
Hello, I'm trying to update the year portion of a datetime field to 2003 that looks like this: 28.06.1997 20:30:07 (european time format dd.mm.yyyy) where I have some bad year entries of value 2034 with the following script: UPDATE oh SET oh_cr_date = '2003' WHERE oh_cr_date IN (select oh_...more >>

Trigger question
Posted by hngo01 at 7/24/2003 12:22:26 PM
Hi all, I have a problem. The table I designed one column using data type is text. Now I tried to do a trigger. The SQL didn't allow me because the data type is text. The average size of this column is about 11000 characters. How do I resolve this problem which including the triggers an...more >>

Can I add a struct or class data type in MS SQL?(empty)
Posted by mariah at 7/24/2003 12:20:49 PM

Calling a VB6 DLL from SQL-SERVER
Posted by Julieta Soligo at 7/24/2003 12:17:58 PM
Hi people, I'd like to know if it's possible or not to call a function from a VB6 dll. If it's possible, how I'm suppose to do it or where I can look for some information. The funcion returns a 6000 lenght string. Any help would be appreciated, Juli....more >>

DB Restore
Posted by Shamim at 7/24/2003 12:06:44 PM
Is it possible to restore a sql 2000 backup to sql 7.0 . If yes, is it direct ?? If no, what are the all option (work-around) to get this done ?? Changing the compatibility level of 2K db to 7.0 and then backup the 2K db, will this backup able to restore to sql 7.0 ?? Thanks Sh ...more >>

HELP!! Invalid Coumn Name err
Posted by Cyberspider at 7/24/2003 12:05:44 PM
Hi; The stored procedure that I am having a problem with is listed below. the field; (select sum(amount) from dbo.HUDDescription where loanid=loan.loanid) as SUMOFADDITIONAMOUNT is used in the very next field GROSSPROCEEDS calculation and generates the error message Invalid column name 'SUMO...more >>

Complex query for all you SQL gurus out there
Posted by Peter B.L. Rasmussen at 7/24/2003 11:51:05 AM
Hi guys, I am stuck on how to approach this problem: I have a table of items, each item exists one or more times, with different data for different time periods, simplified in this structure: item_id, start_date, end_date, price e.g. item 1 can have different prices in different periods...more >>

How to import a boat load of text files.
Posted by rrff at 7/24/2003 11:48:17 AM
I have over 100 text files with the column heading as the first record. They all have a different number of columns and records. The tables do not exist in sql. I'd like to create a table with name of the text file and create columns based on the first row of each file. Then import the data i...more >>

How to break column headers into more than one line
Posted by mitra fatholahi at 7/24/2003 11:40:28 AM
Hello All, I am running the query statment shown below and query the result to a file. As you can see one of my column header is a bit toolong and i like to know how i could break it into more than one line. In other words, is there a way to have column headers in more than one line? ...more >>

Extended procedures in "Master" database
Posted by Michal Svoboda at 7/24/2003 11:37:20 AM
Hi, where I can find information about extended procedures in "Master" database in SQL server 2000? For example "xp_dirtree" or "xp_instance_regread" ... Thank you. Michal Svoboda. ...more >>

case statement help
Posted by max at 7/24/2003 11:36:00 AM
I am trying to count values in a stored procedure using the case statement. The code is below. I get an error when trying to use a catch all > 3. Am I doing this right. What I am trying to do is get all orders that the datediff is = 0, =1, =2., =3 and then all > 3. I have to do this for se...more >>

Right Justify numerical data
Posted by LamP at 7/24/2003 11:23:31 AM
Hi, I am looking for a T-SQL script to right justify numerical data in result, example currency. Thanks in advance, Lam...more >>

Active Directory
Posted by ben h at 7/24/2003 10:34:34 AM
Can someone give me a pointer to what I need to do to get info from our Active Directory, such as peoples names, email addresses, OU, etc etc? I'm new to this, but saw someone else do it. Have no idea what I need to set up in order to access the AD. Do i need to register my MSSQL server on AD ...more >>

Date Fromat
Posted by A.M at 7/24/2003 10:22:18 AM
I underestand default date format for dates SELECT statement returns is: "YYYY-MM-DD hh:mm:ss" I concern if i relay on that format, the format changes in onother server implimentation and my program won't be functional. Can i change that default date format ? Thanks, Ali ...more >>

show only 2 decimals
Posted by Karen at 7/24/2003 10:19:09 AM
What is the syntax to show only 2 decimals and if there is no decimals, I will assign .00 at the end. Select Discount, Total From Table1 Thanks. Karen ...more >>

RollBack Restore - Help!
Posted by Santosh at 7/24/2003 10:14:35 AM
Friends, I have a Database A which had some important Data. I Performed a Restore operation on this Database from another Database B. Is there any way I can get back the previous version of database A, just as it was like before I performed the Restore operation. Any help is appreciated...more >>

Syntax error converting the varchar value to a column of data type int
Posted by Peter Afonin at 7/24/2003 10:00:36 AM
Hello: I'm running a simple stored procedure from ASP.Net application: ALTER PROC uspGetForm @Ord int, @Form varchar(10) OUTPUT AS SET @Form=(SELECT [Form Nbr] FROM tblPressReleasesWip WHERE [ORDER #]=@Ord) RETURN @Form If [Form Nbr] is a numeric value, everything is OK. However, if ...more >>

Divide operator / forward slash in Stored Procedure not recognised
Posted by Graham Ferrer at 7/24/2003 9:56:06 AM
I have a SP which uses a table storing value, timehours & timeminutes. I need to calculate the hourly rate from the total value and time, i.e. value divided by time in minutes multiplied by 60 (mins). The formula I've used is: Convert (varchar(12), (timevalue / ((timehours * 60) + timemin...more >>

Dynamic Sql - Trigger / Audit Tables
Posted by Chelsea McGowan at 7/24/2003 9:43:37 AM
--- I am trying to create generic sql so that - I can log any updated column into a generic table. EX tblDoucmentHistory (DocHIsAID,TableName,ColumnName,OldValue,NewValue) so that there is one table that holds every change in the system -- -- currently i have the system inserting the "N...more >>

join those two procedures stored in only one
Posted by Frank Dulk at 7/24/2003 9:20:46 AM
As I do to join those two procedures stored in only one: Alter Procedure sp400_Delvendstoque ( @codprod int, @qtped int, @numev int, @topest int ) As set nocount on insert TMP_delEstoque SELECT @@spid,@codprod,@qtped,@numev,@topest return -------------------...more >>

Variables in a select within a sp - Question restated
Posted by Phil at 7/24/2003 9:07:12 AM
I believe need to change to convert this and other select into a stored procedure SELECT @PriorityKey=PriorityKey FROM Priority_DIM WHERE PriorityId = @Priority All the select statements are in one large SP and the where clause varaibles are passed to the SP ( WHERE PriorityId = @...more >>

SQL Server Locking Logging (also posted in sqlserver.server)
Posted by Ryan Breakspear at 7/24/2003 8:54:42 AM
Hi All, I'm having a problem with an unknown locking problem, it is occuring at a client site, so don't have the exact details of when it's occuring. I've added the switch (-t1204 -t3605) which are supposed to log deadlock information (to the log file), but this information doesn't seem to be...more >>

PK and Default
Posted by Vlad at 7/24/2003 8:25:04 AM
I'm using DTS to transfer tables from 1 server into another one. During this operation Primary Keys and Default values are lost. How can I prevent that? Thank you Vlad ...more >>

QUOTED_IDENTIFIER and ARITHABORT for Maint jobs
Posted by Vern Rabe at 7/24/2003 8:22:35 AM
Posted in ODBC, no response. SQL 2K, SP3, Win2K, SP4. We've created and scheduled a maintenance job to perform optimization tasks. All was running fine until we added a computed column (without an index) to one of our tables. Now the job fails, reporting: [Microsoft SQL-DMO (ODBC SQLStat...more >>

Extracting data from a field
Posted by Fedeleon at 7/24/2003 8:02:40 AM
How would you extract data from a field within Query analyzer. For example if I had a field which stored an entire sentence like "Hello my name is Rog." How would I create a procedure or function to extract anything after the word "is" Thanks in advance. ...more >>

Select Max
Posted by Lynn at 7/24/2003 7:31:49 AM
I have the following select statement: SELECT PersonID, TotalAmount = Case When ClassID = 'A' Then 'A' Else Convert(varchar(50), ReceivedAmount, 1) End, --Max(date) What I need to do is show the ReceivedAmount for the latest date only. So if there are 3 dates for a person ...more >>

Question Reposted and clarified
Posted by Aaron at 7/24/2003 7:28:56 AM
I have previously selected the top 30 records and manually updated the "ROUND" column to 'A'. Then, I selected top 30 where "ROUND" is null and manually set the "ROUND" column to B. I do not know how to write the script that will select and update the "ROUND" field. I want to grab 3...more >>

Counter
Posted by Anya at 7/24/2003 6:39:11 AM
Good morning. Does anyone knows how to select a counter along with other fields from a table? For example, I have a table: Product ProdName Price Prod1 20.00 Prod2 25.00 Prod3 30.00 Prod4 12.00 I would like to query it and get the following output: Prod...more >>

why update failed on a linked table
Posted by Yanping wang at 7/24/2003 6:28:47 AM
hi, the user met the below problems when trying to update the table records from the Microsoft Access application: the first error msg is : Microsoft/ODBC SQL server driver/SQL server: the text, ntext, image data type cannot be used in the where, having, on clause, except with the null o...more >>

Script question
Posted by Aaron at 7/24/2003 6:17:42 AM
I can't figure out how to create a script to select top 50 * from table update a column with a value then select the next 50, update the same column with different data select the next 50 and so on any ideas? Thanks, Aaron...more >>

Reports
Posted by David Mainzer at 7/24/2003 6:12:46 AM
Does anyone know how to integrate reports generation in ASP based on SQL Server 2000? Could Crystal Reports be used? Thanks david ...more >>

How build this query ???
Posted by lubiel at 7/24/2003 5:56:18 AM
Hello, Someone knows the way yo build this query. you Suppose that i have this tables: Table: Customers Cust-City1-City2-Phone-MaskIn-MaskOut Peter-New York-Miami-1000#5716-American-DataPort Peter-Canada-Boston-null-European-SouthAmerica Peter-Canada-Tampa-null-African-IBASIS Table: Un...more >>

Trigger and Text datatype
Posted by hngo01 at 7/24/2003 5:28:11 AM
Hi all, I have a problem. The table I designed one column using data type is text. I tried to do a trigger which not allowed me too because the data type is text. The average size of this column is about 11000 characters. How do I resolve this problem which including the triggers and con...more >>

DTC error 0x8004d00a on linked procedure
Posted by Fred Stumpp at 7/24/2003 5:16:56 AM
set xact_abort on --tried with and without declare @var varchar(3) set @var='xxx' create table #tmp (f1 varchar(10),f2 varchar(8)) DECLARE @SQLString NVARCHAR(500) SET @SQLString =N'SELECT * FROM OPENQUERY (linkedPSQL2000db,''call spl_MyProc('''''+@var+''''')'')' insert into #tmp --this seem...more >>

Changing Incremental Value of IDENTITY
Posted by Anand at 7/24/2003 4:44:53 AM
hi Can we change the Incremental value of the IDENTITY column in T-SQL without using ALTER TABLE Command. I mean, as we can change the Seed value using DBCC CHECKIDENT, is there a way to change the Incremental Value. Thanks Anand ...more >>

Dont want to see the exec sp_executesql result
Posted by anders at 7/24/2003 4:36:54 AM
Hi! I have a problem, i dont want the exec sp_executesql to promt anything to the screen. Just run in the backgroung and dont show the result. sql code: .... SELECT @sSQL = @sSQL + ' LEFT OUTER JOIN it_reg_kringut AS kringut on kringut.id = ut_kringut.kringut_id ' .... IF(@m...more >>

problem executing stored procedure
Posted by Md. Abdul Jalil at 7/24/2003 4:01:48 AM
i have writen a stored procedure in sql server. while executing this stored procedure in vb-ide error occures. i am writing details on it. please reply me. details is given below: suppose there is a database in sql server named test, a table named tbltest and a stored procedure named s...more >>

Dynamic Cursor using SQL
Posted by Martin.M.V at 7/24/2003 3:52:10 AM
Declare @mSQL VarChar(1000), @mTranId int Set @mSQL = 'SELECT TranId FROM [Standard].vw_AccountsTransaction' DECLARE @myCursor CURSOR --SET @myCursor = CURSOR SCROLL KEYSET FOR SELECT TranId FROM [Standard].vw_AccountsTransaction -- This Working ---SET @myCursor = CURSOR FOR SELECT ...more >>

Similar to Synonyms in Oracle
Posted by Anand at 7/24/2003 2:01:52 AM
Hello, In oracle we can define a synonym for schema.tableName Can this be done in SQL Server? If yes, how? Thanks Anand...more >>


DevelopmentNow Blog