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 > august 2003 > threads for thursday august 7

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

Database Representation of Undirected Graph (Peer Nodes)
Posted by Dave at 8/7/2003 11:10:15 PM
I'm trying to figure out the best way to represent a network of nodes in an undirected graph. Each node can have n peers. I'd like to be able to derive the following: 1) Count all nodes in a given network 2) Retrieve all nodes closer than X steps away from a given node 3) Retrieve all n...more >>


help me with repace
Posted by chughes NO[at]SPAM playlegal.com at 8/7/2003 10:55:46 PM
I am trying to replace any text after and including a minus from a column can someone suggest an easy way. The idea is that I may have one column that might have ch-120 or gh-130 how do i go about gettinbg rid of anything after and including the -...more >>

Import huge data quickly...DTS/ Asynch stored proc....
Posted by samirpandey NO[at]SPAM hotmail.com at 8/7/2003 8:18:54 PM
I have a table which contains approx 3,00,000 records. I need to import this data into another table by executing a stored procedure. This stored procedure accepts the values from the table as params. My current solution is reading the table in cursor and executing the stored procedure. This tak...more >>

Best method for obtaining unique values?
Posted by David Adams at 8/7/2003 8:08:14 PM
Hi, I am trying to generate a unique value based on a set of customer defined values plus an incremental number. I have a table that contains an integer value and contains the customer defined values as such. CREATE TABLE [dbo].[Settings] ( [AppID] [int] NOT NULL , [AppPrefix1] [char] (...more >>

How to update the entire conent of page results into a field
Posted by Fox at 8/7/2003 7:09:12 PM
I know I am often asked to post my entire creation, attempted query and result. As often is the case I would not know how to do this on this one. It does not even seem the right things to do. My situation is as follows. I am generating quite a large page of results to be seen on the web. Thi...more >>

how to handle ties when getting count
Posted by Lachlan James at 8/7/2003 7:05:33 PM
H, I have the following query that selects some users from my database who voted for the player with the most votes. The query works, but if there is a tie in the select TOP statement I would still like to retrieve those records. Is this possible? -- get most voted player DECLARE @m...more >>

which performance is better
Posted by Yibing Wang at 8/7/2003 5:46:19 PM
hi, there from sql2000, user can also use user-defined function to return result like table. i am wondering, between Function and SP, which performance is better? appreciate your help ...more >>

BulkCopy Import question
Posted by Frank Cheng at 8/7/2003 5:05:10 PM
Hi all, I have exported all the content of one of my tables to a text file. If I were to clear the content of that table, then did a import data in Enterprise manager, everything worked fine. However when I tried to import the data programmatically, the ImportData for the BulkCopy object alw...more >>



Stored Procedure Performance
Posted by TJ at 8/7/2003 4:45:30 PM
I have a sp (A) that needs to execute logic in another sp (B). In terms of performance, does it matter whether sp (A) calls sp (b) or should I copy sp (b)'s the script into sp (A)? Will I take a performance hit for calling one stored procedure from another? Or making recursive stored procedure ca...more >>

Convert Exec (SQL) to Exec sp_executesql 'SQL'
Posted by Ricky at 8/7/2003 4:26:14 PM
I have a dynamic sql stored in @vcSQL varchar(4000) variable. Parameters are @res varchar(20), @sdt smalldatetime, @sdt1 smalldatetime, @cPlant char(3) set @vcSQL = 'select at09.datetime,isnull(at09.Value,0) as [TK # 09] from ' + case @res When 'Hourly' Then 'fn_PIGetHourlydataForPlant...more >>

Next SQL2K command runs ok 50-100 times... and then returns no records.
Posted by Bill at 8/7/2003 4:19:50 PM
I'm running SQK2k on a Windows 2K Server box. My client machine is using W2K Pro and some client-side VBscript (v5.6) with some pretty standard/common calls like "CreateObject("microsoft.xmlhttp"), open, send, responseText and ADO" in order to fetch some data from the server. I have about 4...more >>

Calculating a unique hash on 4 columns in T-SQL?
Posted by Steven at 8/7/2003 3:20:31 PM
Is there a way to calculate a unique hash value based on the combination of 4 column values (two Nvarchar and two Int)? I attempted to calculate a hash in T-SQL for the combination of 4 columns by concatenating the 4 column values in a string and then calculating the CHECKSUM on the string b...more >>

Currency Symbols,,
Posted by Julio Gonzalez at 8/7/2003 3:15:04 PM
Hi all.. I have an application used by people from differents countries, the matters is that I need to display on reports money simbols according to the currency of each country, i.e Users From Japan Customer A S10 Customer B S20 Where S is the simbol and should be Yen sim...more >>

Full Text Search: How useful is it?
Posted by Tom Tom at 8/7/2003 2:53:23 PM
Hi, I'm wondering how useful the Full Text Search feature is. It seems to me that combinations of "LIKE '%searchtext%'" do the job just fine. Are there advantages in using it, other the full text search can be a lot faster than using LIKE? Thanks! TomTom ...more >>

Question about OpenRowset with MSOLAP
Posted by Mark Andrews at 8/7/2003 2:32:59 PM
I have a view which queries an OLAP cube using OPENROWSET and the MSOLAP provider. ---------------------------- ALTER VIEW dbo.TQA_Contact_All_Count_Cube AS SELECT 'All' AS TheText, [[Company]].[All Company]]] AS TheValue FROM OPENROWSET('MSOLAP', 'DATASOURCE=PGHHQMANDREWS2;...more >>

newbie question about "first"
Posted by suzy at 8/7/2003 2:32:37 PM
hello, i have a table with a list of group_names (varchar) and a list of group_dates (datetime) and a list of group_type_id's (bigint). i want to retrieve a list of group_names, grouped by group_type_id, but i only want to retrieve the EARLIEST group_name (depending on that date column). ...more >>

Funtions With Multiple Parameters
Posted by Brij Singh at 8/7/2003 2:17:16 PM
Hi , what wrong do i m doing in this Create Function CREATE FUNCTION getPriceByEffective (@EffectiveDate varchar(10), @CurrentPrice money, @NewPrice money) RETURNS money AS BEGIN DECLARE @Price Money IF @EffectiveDate IS NULL THEN SET @Price = @CurrentPrice ELSE SET @P...more >>

FileSystem
Posted by Henry at 8/7/2003 1:36:32 PM
OK here's the scenario, I would like to archive file system files that relate to completed claims in out database. An run a job to perform this task every night by simply moving the files into an archive directory that can be burn to cd once a week or so... I have created a linked server for t...more >>

SQL Server 2000 updates and performance degradation
Posted by contact NO[at]SPAM guffy.net at 8/7/2003 1:07:58 PM
I have a database table with about 50,000 records. As it grew from 0 records to the current size I noticed that updating a single row took considerably longer. According to Profiler an update initially required less than 10 logical reads. At the table's current size the number of reads is mor...more >>

Update trigger on a replicated table
Posted by Prasad Koukuntla at 8/7/2003 12:24:11 PM
We are using SQL2000, SP3a with transactional replication.. In the subscriber database, we have a table with an update trigger that updates another table (TableX). This trigger does not include "NOT FOR REPLICATION" phrase. This table is being replicated by the publisher. The changes at the pu...more >>

Rename database file
Posted by David B at 8/7/2003 12:23:00 PM
Hi, I am having trouble renaming a database file (.mdf). The data was originally created just using Create Database MyDb Now I have renamed the database using sp_renamedb @dbname = 'MyDb', @newname = 'MyDb1' which has been successfull. Trouble is it did not rename the file "C:\Program Fi...more >>

Error: m_offBeginVar < m_SizeRec
Posted by Adam Knapp at 8/7/2003 10:32:30 AM
Last night I upgraded to SP3, now it seems like nothing is working correctly. I do generate large tables every night. Now a simple query will work. It looks like any query with a "join" in it gets this error. The error I'm getting is: Server: Msg 3624, level 20, state 1,.. Location...more >>

Clarification
Posted by RK at 8/7/2003 10:20:56 AM
What if the data is stored as shown in the W x H x D format and,if stored as 3 different columns ... now, of course, data types in both scenarios .. if varchar, how to find height? etc. ...if stored as separate values, then how to find for the entire dimension as awhole? hope this will help so...more >>

loopback linked server on a distributed transaction
Posted by Luis at 8/7/2003 10:18:20 AM
I'm working with two databases in distinct servers, I'm using Linked Servers to access the data between servers (Server1 has a linked Server2, and Server2 has a linked server to Server1) I've a trigger on Server1 that updates tables on Server2, one of that tables on Server2 has a trigger t...more >>

when / then syntax
Posted by jt at 8/7/2003 10:06:12 AM
i am using the following syntax to combine two selects into one for performance purposes: SELECT @premium_balance = SUM(CASE gl_account_id WHEN 20 THEN amount ELSE 0 END), @markup_balance = SUM(CASE gl_account_id WHEN 13 THEN amount ELSE 0 END) FROM tGLDetail WHERE contract_id = @co...more >>

SQL Version
Posted by Ron at 8/7/2003 10:05:47 AM
I have purchased Office XP Professional which has Access. Access has some Visual Basic programming ability and some SQL ability. This was an Dell OEM installed computer so I recieved no documention or help whatsoever. I have tried to use the SQL functions with virtually no success, especial...more >>

Joining the rows
Posted by Simon at 8/7/2003 9:55:09 AM
I have SELECT statement which returns the result: productName quantity colRef colAll product1 4 0.5 0.2 productxy1 2 1.4 0.11 product2 3 2.1 0.33 productxy2 1 0.2 ...more >>

SQLDMO programming
Posted by VBM at 8/7/2003 9:44:57 AM
I want to use SQLDMO to check the version number of all the SQL Servers on the network....I get the list of servers..how can I check the version number I am using following code Dim i As Integer Dim oNames As SQLDMO.NameList Dim oSQLApp As SQLDMO.Application Set oSQLApp = New S...more >>

Newbie question - Trigger on Update
Posted by Nathan at 8/7/2003 9:17:49 AM
Hi: I need to write a trigger that inserts a row in a log table when an update occurs. The log table is a generic table with old value, new value and the date of changed. Any help appreciated Thanks ina dvance...more >>

!! I need getdate for midnight
Posted by tania at 8/7/2003 8:59:06 AM
Hi declare @today datetime set @today=getdate() Now I want to get rid of the time part. It needs to default to midnight, which is the start of today. How do you do this ? Thanks Tania...more >>

Information_schema.routines Q
Posted by Ricky at 8/7/2003 7:30:19 AM
I am defining udfs for calculations that can be used multiple times at different places without rewritting the whole calculation again and again. I need to capture the body of the udf defined to search for any words that begin with 'Met%', 'Sen%' etc. I thought Information_schema.routine...more >>

Returning the newly create PK
Posted by Mark in miami at 8/7/2003 6:44:34 AM
I've been talked into implementing my dB calls in ADO.net using stored procedures to do things I'd normally do with adhoc SQL in-line code. Therefore, I have the following code to INSERT a record into a table. The PK for the table is an identity, so it will automatically assign a new IS ...more >>

N macro
Posted by Arne at 8/7/2003 6:35:10 AM
What does the N macro do?: SELECT @device_directory = SUBSTRING(phyname, 1, CHARINDEX (N'master.mdf', LOWER(phyname)) - 1) FROM master.dbo.sysdevices WHERE (name = N'master')...more >>

Help! What is the correct way to insert without dups...(see msg)
Posted by Craig Stadler at 8/7/2003 6:15:56 AM
Assuming you have two identical structure tables 1. A and B that have field1 and field2 (field1 is the primary key) 2. A gets some new records that you want to add to B (no dups) 3. I have tried all these below : Insert into B (field1,field2) select field1,field2 from A where field1 not i...more >>

table variable identity reset
Posted by Bill at 8/7/2003 5:28:00 AM
If I create a table variable in a stored procedure with an identity column, how can I reset the identity? For example, declare @TestTable table(SomeIdentity int identity(1,1), SomeField char(5) NULL) insert into @TestTable (SomeField) values ('test1') insert into @TestTable (SomeField) v...more >>

Variable in stored procedure
Posted by Ilenia at 8/7/2003 5:25:36 AM
Hello!!! I have a variable called @strBody VARCHAR (8000) in a stored_procedure, but I need to have a variable more capable than her maxim length. What could I do? Has someboy some suggestions to give me? Thanks!!! ...more >>

Importing Web Query From Excel
Posted by Tom Y at 8/7/2003 4:57:41 AM
Whats the best way to import data from an excel spreadsheet that contains a Web Query. How can I get the Web Query to Refresh before the import takes place(DTS or whatever) Any help on this would be great...more >>

filename in variable
Posted by Raik Hoffmann at 8/7/2003 4:19:37 AM
Hello, I want to bulk insert the log files from my IIS and therefore wrote this script: DECLARE @file char(46) SET @file = 'C:\WINDOWS\system32\Logfiles\W3SVC1\ex' + Convert(char(6), Getdate(), 12) + '.log' BULK INSERT [dbo].[tablename] FROM @file WITH ( FIELDTERMINATOR = ' ', ...more >>

multiuser safe IDENT_CURRENT(...)
Posted by Vadym Stetsyak at 8/7/2003 3:16:41 AM
Hello! In the SQL Server documentation is said that it "returns the last identity value generated for a specified table in any session and any scope" To obtain unique numbers client makes one insert and than calls IDENT_CURRENT. So rises the question is it possible that 2 or more c...more >>

split the string by using the cursor
Posted by Naren at 8/7/2003 3:02:44 AM
hi, i need one help regarding the string comparasion using Cursors. the string contains "a,b,c,d",by using this string i want individual string to display basing on the comma operator. i have to display the result in this way a b c d how can i split the string by using cursors. thanks ...more >>

create an aggregate table, large volumes
Posted by jerome at 8/7/2003 2:21:48 AM
Hi, I've a transaction table, something like TRANS_TABLE: TRANSNO (k),TRANSDATE,PRODUCT,QTY,OK The column OK has values 'Y' or 'N'. There are many rows with the same date and product and ok-code. From this I need to create an aggregated table: AGGR_TABLE: TRANSDATE (k),PRODUCT (k...more >>

Help with Trigger
Posted by Mark at 8/7/2003 2:09:56 AM
Hello. I have a trigger which creates a log file, but it failed when more than one row was updated. As a quick fix I used a Cursor but I am sure that it could be re written without the Cursor. I am new to SQL so any help would be greatly appreciated. The Trigger query is as follows:- ...more >>


DevelopmentNow Blog