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 > november 2003 > threads for monday november 17

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

Insert rank within a group
Posted by Steven K0 at 11/17/2003 11:15:12 PM
Hello, Looking at another message, I was able to come up with the following query to apply a rank to ciites based on the company for example: Company1 Denver 1 Company1 Durango 2 Company1 Gunnison 3 Company2 Chicago 1 Table Structure ---------------- Business varchar...more >>

splitting up a , string
Posted by AussieRules at 11/17/2003 11:05:56 PM
Hi, I pass a string into a SP, that is actually a bunch of int values seperated by the ',' char. (1,4,2,54,2,1) I want to pull out each int, and insert it into a table. Just started to get into SP code, and have no idea how to do this. Any help would be great... Thanks ...more >>

Storing large files on a server
Posted by Gary Nastrasio at 11/17/2003 11:01:36 PM
Hi guys, first, sorry if this is the wrong form for this, but I hate cross posting and I had to choose someplace to post. Anyway, here's my project: - Database server running SQL Server 2000 - Database server stores files of size generally > 3MB - Client program accesses SQL Server 2000 an...more >>

IDENTITY columns
Posted by Gabriella at 11/17/2003 10:43:47 PM
I need to consolidate 2 seperate databases into one. The databases are identitical and the majority of the tables have an identity column as a primary key, which columns are then referenced in other tables. Since all the tables from both databases have basically the same key value (unless...more >>

UNION query
Posted by Frank Dulk at 11/17/2003 10:01:37 PM
I made an UNION query of a way that didn't please me, and it would like your suggestion. PROBLEM: I need the sum of a field amount of 2 different tables contained by the same badge, I explain: I have the tables Items of Sale and Items of Production. The two have a field Item that is the b...more >>

Modified tables since last week.
Posted by Sanka at 11/17/2003 9:03:01 PM
Hi All, Is there a way in MS SQL server to know that which all tables have been modified (insertion, deletion or updation) in the recent past? For e.g., I might want to have a list of table names which have been modified since last week. Cheers, Sanka...more >>

Substring with text data type
Posted by FDB at 11/17/2003 8:54:40 PM
Hello, I am using function SUBSTRING for a data type text,but when it exceeds 8000 bytes, appears the message: "Invalid lenght parameter passes to the substring function" Somebody can help me ? Thanks. ...more >>

getting the system time into SQL
Posted by J at 11/17/2003 8:09:11 PM
Hi All Anyone know how I can retrieve the local system time from a SQL server and then insert that value into another SQL server's table? Thanks J...more >>



How to generate 'full' scripts for database objects?
Posted by Brian at 11/17/2003 8:05:11 PM
Hi Is it possible to generate full create table scripts that include default values etc in addition to the default? I find default values very useful, and often have to pass sql scripts to others for deployment. -Brian ...more >>

How to get values from queries, and then using in another query?
Posted by Iain at 11/17/2003 8:01:05 PM
Hi I have the following tables and stored procedure. I need to pass a value to the stored procedure and have it use the value in a query. After running that query it will return an ID which is then used in an insert statement. At present the values in @MovieId int, @UserID int are left empty...more >>

Looping a recordset in SP, more details !
Posted by Filips Benoit at 11/17/2003 7:37:13 PM
Aaron, Thanks for following me! About 'some actions' I want to copy an order and its properties ( tables: ORDER, ORDER_PROPERTY mapping orders and properties) ( table ORDER_PROPERTY: OP_ORD_ID, OP_PRP_ID and OP_VALUE) The SP that copies the source-order > new order works OK and returns...more >>

Connect to SQL Server 2K?
Posted by Jack Wen at 11/17/2003 7:37:09 PM
In the local area network,using the machine name can connect to the SQL Server, but using the Ip Address can't, why? I've configured both the server and clients to support the Pipe and Tcp/Ip protocol and the server side can reply the clients side by pinging,vice versa. Any suggestions? T...more >>

numeric column for dates
Posted by Ray Bouknight at 11/17/2003 6:33:03 PM
How do I avoid scans when searching by date criteria (e.g., is null, max/min, etc.). I am thinking of using another column which is searchable (e.g., 0 for Null, an integer/long for datetime). Has anyone ever done this or is there a better way of accomplishing this search? CREATE TABLE [dbo]...more >>

Help with complex Group By
Posted by John Rugo at 11/17/2003 6:25:19 PM
Hi All, I have to come up with a report but am having a problem learning the basics regarding Group By. It's a fairly complex task I have been assigned so I will try and explain lightly. Company | Total Completed | Percent Completed On Time | etc... A ...more >>

insert the row number within the same group
Posted by tl at 11/17/2003 6:20:00 PM
Hi, i need help on inserting the row number in the same group. for example, in the SQL Server database originally, Row Number Color ================== 1 red 2 red 3 red 4 ...more >>

Duplicates values
Posted by Dean at 11/17/2003 6:17:34 PM
I have a table called T1 and primary key A, columns B and C. I would like to determine if there exist duplicate values for column B and C. A B C 1 2 3 2 3 4 3 2 3 There exist duplicate values for columns B and C. (2,3) Primary keys 1 and 3 have duplicate values. ...more >>

How can I turn of logging with Query Analyzer update query?
Posted by Craig Stadler at 11/17/2003 5:29:33 PM
Is it possible to disable logging when performing an Update query with Query Analyzer? If not can it be done via bcp? The reason is I don't have enough disk space for a large update. -Craig ...more >>

Similar dlookup() function?
Posted by Ling at 11/17/2003 5:26:07 PM
Does SQL server programming support similar Dlookup() as like the one in access? in access: DLookup("[query name]![field name]", "[query name]", "") Thanx Ling...more >>

complex query
Posted by middletree at 11/17/2003 5:16:40 PM
Background: Classic ASP app, takes in info about trouble tickets for a tech support team, uses SQL Server 2000. One table called Ticket has exactly one row per ticket. Table called History has zero, one, or many rows per ticket. One of the fields in History is "Status" (status examples include c...more >>

Setting Port number?
Posted by Adam Right at 11/17/2003 5:12:31 PM
Hi, I want to set a particular port number when connecting to the sql server. Can be it be possible to set it in the connection string? Because, i do not want to use default port number to connect sql server? thanks... ...more >>

SQL Server 7/2000 APP_NAME() Connection Identification Problem
Posted by Robert E. at 11/17/2003 5:08:55 PM
*apologies for multipost Hey we have an SQL7 box (soon to be upgraded to SQL2k) we have in-house client software that connects to a db hosted on the box via ADO + SQLOLEDB. Our client software always specifies an "Application Name=" parameter in the OLEDB connection string. The applicatio...more >>

Stored Procedure variables
Posted by Kevin In Washington at 11/17/2003 5:08:12 PM
I have a monolithic stored procedure that I have inherited and I want to break it into smaller logical pieces. I can pass some values from a parent procedure to a child procedure. My problem is that I am not sure how I can go about using values returned/derived from the child procedure wi...more >>

Can I use a 'result set' as a list of table names in a FROM clause?
Posted by Steve Hiemstra at 11/17/2003 4:28:57 PM
Hi All, This is something that I always knew I'd have to do in SQL queries, but never had the opportunity to learn: I have a query that returns a single column result set that contains the table names I need to use in the 'next' query... How do I do this without resorting to some kind of 'l...more >>

Need to parse data into fields in SQL 7.0
Posted by Mike Johnson at 11/17/2003 3:50:36 PM
I need to take a data from a field that is actually several fields of data delimited by a CHAR(13) and out put them into seperate fields. Example (I put a "~" in place of the CHAR(13)): Field1: 'abc~def~ghi' I will need to change to: Field2: 'abc' Field3: 'def' Field4: 'ghi' The g...more >>

Identity Column
Posted by Levi Nkata at 11/17/2003 3:42:18 PM
How can one initialise the identity value in a table. After running tests on a table, I now want to clean the table and start entering data afresh. How I can I accomplish this?...more >>

Problem with SQL Statement repost
Posted by Mel Weaver at 11/17/2003 3:39:05 PM
I have two tables First one is Clients FullName : nvarchar 50 ClientId : primary key Second Table is Policys ClientId Policy_Id : primary key Company : nvarChar 50 ToDate : DateTim...more >>

How can I find the datatype of a data in the column?
Posted by Ratna Garapati at 11/17/2003 3:31:07 PM
Hi, I have a table A with only one column of datatype varchar. This column can have numeric or alpha values. For example: 'A', 'B', '90', '60' I want to write a query that will return the datatype of the data. Is it possible to do this? Any help is greatly appreciated. Thanks, Ratna. ...more >>

Problems with SQL Statement
Posted by Mel Weaver at 11/17/2003 3:25:00 PM
I have two tables First one is Clients FullName : nvarchar 50 ClientId : primary key Second Table is Policys ClientId Policy_Id : primary key Company : nvarChar 50 ToDate : DateTim...more >>

SELECT....If Column is Null then select the value from another
Posted by John Rugo at 11/17/2003 3:06:48 PM
Hi all, I want to select a column's data only if it has a value. If it does not than I wish to select from another column regardless; but I want this to be in a single column. My example: SELECT IF (col1 IS Null) col2 AS [ReportColumn] FROM TABLE1 Thanks for the help. ...more >>

Query Agent jobs
Posted by GriffithsJ at 11/17/2003 3:02:32 PM
I need to do an SQL query that reports the names of SQL agent jobs. Not sure how to do this, any ideas? Thanks Griff ...more >>

Stored Procedure - How to create queries based on information from a select statement
Posted by Andrew Mueller at 11/17/2003 3:02:00 PM
Hello all, Here is what I am trying to do... I have several items in a row which represent ID's and I need to query information from another table based upon that ID. For example: TABLE1: CharacteristicID1, CharacteristicID2, CharacteristicID3, etc.... TABLE2: Characteristic...more >>

How to select a newest record
Posted by hm at 11/17/2003 2:57:28 PM
I have a table with the following fields: ID (Index) FirstName LastName Email EntryDate Field1 Field2 Field3.... I like to delete all rows with duplicate email address except keeping a newest entry of that email. Therefore, the table should not have any duplicate email address by deleti...more >>

Micrsoft Report Tool
Posted by dwight NO[at]SPAM trumbower.com at 11/17/2003 2:26:50 PM
Is MS creating a new report tool to compete with Crystal Reports? Is a copy available for review? Thanks...more >>

SQL & VB & adVarWChar
Posted by aleXsticY at 11/17/2003 2:24:13 PM
Hi, I'm using stream object to get the call and get the return of a SP SQL 2000. I would like to know the size of a adVarWChar (actually a text type in SQL) ..Parameters.Append cmdProfileSoft5.CreateParameter("@sClientXML", adWVarChar, adParamInput, ??????, vsClientXML) Thanks, ...more >>

SQL Insert Procedure with MONEY datatype
Posted by Kieran at 11/17/2003 2:23:22 PM
Hi, Here's the sp: @intUser int, @intJob int, @intPrice money INSERT INTO ClientPrices( userid,jobid,price ) values ( @intUser,@intJob,@intPrice ) when I execute this: addCLientPrices 1,1,22.50 the price in the table reads: 2250 SQL seems to be removing the decimal pla...more >>

Using the isqlw Utility
Posted by Sonya at 11/17/2003 1:46:08 PM
Hello I am attempting to use the isqlw utility, but so far I have been unable to get the command to work properly. It appears to execute without error, but the output file is never created. I've also tried using isql and osql, but I can't get those two commands to execute without error messages....more >>

auto-creation of "derived fields"
Posted by John A Grandy at 11/17/2003 1:25:59 PM
sql2k i need to create some t-sql scripts that run on a nightly basis to create "derived fields" in a table ... for example, a field created by stripping all non-alphanumeric characters from another field. purpose of the field is to improve peformance for a search that ignores punctuatio...more >>

COLLATE troubles...
Posted by Len at 11/17/2003 12:59:20 PM
Hi there. I am running into collate errors in a simple join between two tables on two separate databases and I can't figure out why: My join is based on an equal to clause between two varchar columns. If I script the tables to window, both columns seem to have the same COLLATE setting ...more >>

group by
Posted by anonymous at 11/17/2003 12:54:16 PM
I have the following query. Where I do a max num. My problem is: I need to group by id1 only, but at the same time display [id]. When I am add the [id] to select list it asked me to add into group by clause, but the result is incorrect. How do I display [id] without having in group by clau...more >>

HEX data
Posted by Andrej Hudoklin at 11/17/2003 12:39:31 PM
Hi, the thing is that I have data from betrive database and fields that create my PK are of data type char, but there comes to an error where the data should be unique, but due to 3 zeros in HEX after the characthers it is not unique. How can I make SQL to see where there is HEX data and wh...more >>

Urgent help - Select date statement
Posted by Pogas at 11/17/2003 12:31:08 PM
Dear all Your urgent help in sql select statement will be greatly appreciated I am developing a dot net insurance quotation application that uses a data-centric web services.Iwant to do a query that brings up automatically policies that are due for renewal two weeks in advance.The following is a...more >>

Median query with a twist
Posted by vkashp NO[at]SPAM yahoo.com at 11/17/2003 12:25:50 PM
Hello, I need a query that would return the median from a table grouped for each region. I have a sales amount coulumn in the table and a region column. I was able to find a query in "SQL for smarties" to calculate the median value, by - Select the max sales amount from the TOP 50 percent of ...more >>

Problem with long Stored Proc
Posted by Jenny at 11/17/2003 12:22:53 PM
Hi, I have a C# program where I call several stored procs. However there stored proc are very long (total of about 15-20 minutes). My Problem is that when a execute the program, it kind of stalls, and its status is NOT RESPONDING. But it seems to execute the Store Proc OK. But we don't...more >>

Intermittent queries
Posted by jackocat NO[at]SPAM canada.com at 11/17/2003 12:14:47 PM
Has anyone ever heard of any issues where SQL Server intermittently does not complete multiple complex queries for a 2 tiered database app with about 10-20 concurrent users?...more >>

Detecting SQL Database blocking
Posted by roco at 11/17/2003 11:56:05 AM
On ERP database goes through a gateway. When it locks up using SQL query Analyser the commamd sp_who2 will list all the id numbers being blocked by. It can take some time to analyxe all the id numbers to find the source where the blockinbg originates. Is their a SQL script to help make this easier...more >>

SQL statement - Create Database
Posted by Ron Lang at 11/17/2003 11:55:59 AM
I'm a newbie to SQL programming for SQL Server 2000. My experience has been limited to creating Access databases using Visual Basic 6.0 and DAO. I recently learned how to create a .mdf database using the Enterprise Manager. I've also learned how to connect to this database using VB 6 code as f...more >>

Online Warranty Registration Table
Posted by Manat K. at 11/17/2003 11:26:08 AM
Hi all, I have a consumer services project coming up, and we will our our online product warranty registration online soon and I have a few important questions: 1) The SQL Server will not be hosted at our ISP, it will be hosted in-house here, unlike our Web Server, any problems o...more >>

Joining a UNION to another Select
Posted by Shaggy Dragon at 11/17/2003 11:25:41 AM
Hi there, I've created the following simple UNION query: SELECT SecurityNumber, Book FROM Trades UNION SELECT SecurityNumber, Book from Positions; I'd really like to show is all the fields from the Positions table, but these don't exist in the Trades table, so they can't be included in the...more >>

openquery
Posted by Rob at 11/17/2003 11:16:34 AM
BOL says that 'OPENQUERY does not accept variables for its arguments'. So, I tried using something like: Declare @qry varchar(1000) Set @qry = 'select * from OPENQUERY (<linked_server_name>, ''<query>'')' exec (@qry) Would this work? Thanks....more >>

update event log from sqlagent active-x job
Posted by Peter Scott at 11/17/2003 11:09:44 AM
Hi I'm trying to debug an active-x script that is run as an sql agent job. I want to see the values of some variables as teh job runs and I am trying to update the event log with some messages. Does anyone have any code to show how to do this - or better still how to see output as a...more >>

Optimizing a UDF
Posted by Cheung, Jeffrey Jing-Yen at 11/17/2003 10:26:57 AM
I'm trying to write a UDF that will strip out any non-numeric characters. I have the functionality working; however, it is painfully slow when I run this UDF on a column belonging to a table with many rows. Is there anyway I can optimize this? (Excuse the wordwrap) CREATE FUNCTION dbo.Tr...more >>

creating stored procedure in master
Posted by Mark Field at 11/17/2003 10:22:48 AM
We want to create a stored procedure in the Master database that anyone with a valid login on our server can execute. If we grant rights to the Public role in the Master database for this stored procedure will everyone be able to execute it, or will we still have to make everyone a user of the ...more >>

Help with the SELECT statements please.
Posted by Lam Nguyen at 11/17/2003 10:09:15 AM
Hi all, I posted this on last Friday and OJ was helping me with the queries but the queries took almost 2 minutes to run. I have almost 8 millions rows and joins with 5 different tables. I just create a quick Test table below and the SQL statement run find and return the CORRECT r...more >>

Joining to a Stored Procedure?
Posted by Rob T at 11/17/2003 9:57:18 AM
Hi, I have a stored procedure that I lifted from BOL and slightly modified it. I would now like to get it into a dataview so I can link the results to other tables and/or filter the results. Is there a way to do this? Thanks. PS: here's the SP if it helps out....it came from BOL: hie...more >>

Update Scenario for Stored Procedure
Posted by Lontae Jones at 11/17/2003 9:51:07 AM
Hello I have a user that needs to update values in one table periocally and i dont want to give this person Enterprise manager or query analyzer. Is there a way to create a view or sp for this user to update values in this table periodically I have a table called Account Columns (AccountID va...more >>

A Max(CASE) Query?
Posted by Mij at 11/17/2003 9:45:48 AM
Hello, I am working on a system to track violations from an inspection. I have the following two tables for violations and follow-up violations (a subset of violations). : CREATE TABLE [dbo].[tblInspVio] ( [Inspec_ID] [int] NOT NULL , [Vio_ItemNum] [smallint] NOT NULL , [VioType_ID] [...more >>

How to change the LastBackup property of a transaction log
Posted by Geir Åge Jenssen at 11/17/2003 9:16:38 AM
I need to change the property LastBackup of a transaction log. Anybody who now how to do this? Thanks Geir ...more >>

problem with SUM
Posted by Gita George at 11/17/2003 9:13:14 AM
I have a table that contains invoices and I need to select a number of invoices to wich the sum of the value is less or equal to a certain value. Please help. Thanks ... ...more >>

Question about @@ROWCOUNT
Posted by Shelly at 11/17/2003 8:52:26 AM
Hi, I would like to know if @@ROWCOUNT is tied with the current connection from where it is called? In other words, if I use @@ROWCOUNT in a stored proc, will it return the numbers of rows from the last operation for the current connection only, or is it taking all the connections into...more >>

getting top 2 records for each type
Posted by blarfoc NO[at]SPAM yahoo.com at 11/17/2003 8:50:29 AM
hello, i can't get this to work. i only want to see 2 from each carrier. thanks! AP declare @shipments table ( carrier char(3), trackno varchar(10) ) insert into @shipments values ('UPS', '1ZOI230932') insert into @shipments values ('UPS', '1Z023093M3') insert into @shipments values...more >>

Help with UDF
Posted by Shell at 11/17/2003 8:36:53 AM
In a UDF with a parameter @param, you can do following: if exists (select * from table where col = @param) set found = 1 How do you make it work for case like: if exists (select * from table where col like '% @param % ') set found = 1 I know this is kind of dynamic SQL. Is it possi...more >>

Impossible SQL(?)
Posted by Tod Broswoski at 11/17/2003 8:35:04 AM
Hi all, My challenge is to get all possible combination pairs of values from my table and their counts. I can get it done with a temporary table with a cursor and then get the count, but I am looking for a single query solution. ddl follows... ------------------table create table mytabl...more >>

convert
Posted by Shaun at 11/17/2003 8:30:58 AM
Hi I am having a problem with converting a varchar column that has dates in this format 07/06/1998 would anyone know why. thanks for any advice Shaun this is my query: select convert(smalldatetime,datecreate,103) from iuk_invoice where custname like 'net%' the error:Server: M...more >>

DIAGRAM AND ITs MEMEBRS FROM SYSTABLES
Posted by laurel at 11/17/2003 8:25:40 AM
I have a diagram with relationships upon it. I want to pull a list of all tables that are in that diagram and the details about the relationships from the systables. I found the diagram in dtproperties. Any way to get the rest? L...more >>

Problem placing a file into a SQL database
Posted by Steve Cena at 11/17/2003 6:24:49 AM
I am using a web server package called PerfectTracker by AvenSoft (http://www.avensoft.com). The SQL statement I am trying to execute is the following: INSERT INTO ST_ATTACHED ( FILE_ID , ROW_VER , TRACKING_ID , FILENAME , DESCRIPTION , FILE_SIZE , FILE_DATE , FILE_DATA ) VALUES ( local.f...more >>

Insert & Update on A joined Table Query
Posted by Peter Newman at 11/17/2003 6:02:10 AM
I have a joined Table Query Select * from ClientAdminDetails as A JOIN ClientRegisteredUsers as B on A.ClientReferance = B.ClientReferance Where a.ClientReferance = '21266747514' Order By A.ClientReferance I the Operator wishes to make any changes to the data, is there a simple wa...more >>

How can I read column description through SQL-DMO
Posted by Michael Peng at 11/17/2003 5:16:02 AM
We can get extended property(like description of column or table) through fn_listextendedproperty. Is there anyway do this by SQL-DMO. Michael Peng ...more >>

COMPILE
Posted by Phil at 11/17/2003 5:12:34 AM
Hi All. I have a stored procedure that after it has been ran a few times need's to be re-compiled to get it working again. Is there some code that I could write into the Stored Procedure to do this automaticaly. Thanks Phil...more >>

Functions in Queries
Posted by Brandon Campbell at 11/17/2003 4:52:48 AM
Hello, I have moved several Access databases up to SQL but I have a problem in several of my queries. Access allows a great deal of freedom in writing functions in queries ie the IIF function and others. Is there a way to convert these functions or do I have to write something else. Some ...more >>

How to get the entire row from a unique column
Posted by vbsql2k NO[at]SPAM hotmail.com at 11/17/2003 2:30:19 AM
Using SQL2k.. I thought this was simple. I need to send emails out to unique email addresses from a table that may contain duplicate email addresses. I really don't care which row is returned as long as I only get one row per email address. In the example below I want either Bob Smith from ...more >>

Trigger error using TEXT data type columns
Posted by Ray at 11/17/2003 1:48:41 AM
Hi All, I have a source table wherein some columns are "TEXT" data type. I want to create a logging of data being updated or deleted from this table. I have a mirror table containing the same set of columns as what I have in my source table except for TIMESTMP, USER_RESPONSIBLE, ACTION_TY...more >>

Advice for a beginner
Posted by Ling at 11/17/2003 1:01:23 AM
Hi, I am very new to SQL server programming Currently, I have a access application where calculations are done in VBA. Now I linked the tables to those in SQL server so I have to use stored procedures For eg, if one of my stored procedures return a value, I should I write the code in VBA to refer ...more >>

getting date out of 'timestamp' column??
Posted by santy at 11/17/2003 12:36:51 AM
Hi Please help if you have any idea on how I can get date from timestamp column.I am using SQL , VC++ . (I tried using CAST but to see 1900..as year in all the rows.But when I tested to cross check the values using DTS ,exporting to flat file..It shows me correct date.) ...more >>


DevelopmentNow Blog