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 > december 2003 > threads for friday december 12

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

Select top 1 hangs, but select top 2 no problem!
Posted by ck at 12/12/2003 9:26:37 PM
I am doing a relatively straightforward select top 1 against a few joined tables, select involves some text e.g. select top n 'Name: ' + name from table1 join table2... When I select the top 2, 3, 5, 100, etc, it comes back no problem, but select top 1 hangs indefinitely! (I end up cancellin...more >>


Decimal to Double data type
Posted by Scott at 12/12/2003 8:35:43 PM
I've written some SPROCs that declare variables like below using DECIMAL type. For future compatibility reasons with existing databases, I need to switch from DECIMAL to DOUBLE type. What would be the syntax to use on below variables to make them DOUBLE type? declare @sDowntime decimal(10, 6...more >>

Spatial data types and functions in Yukon.
Posted by Ami Einav at 12/12/2003 8:09:00 PM
Hello, Does anyone know of MS roadmap regarding Yukon's support for real spatial data types (like Oracle's SDO_Geometry) and support for spatial functions? We need a monolithic database for both geospatial and regular,non-geo data. I'd hate to have to convert from SQL Server to Oracle just for ...more >>

Sort Error
Posted by Greg G at 12/12/2003 7:56:07 PM
SQL2000 Enterprise SP3 When running a fairly sizable query, I get the following error: Cannot sort a row of size 1047, which is greater than the allowable maximum of 615 I have not seen this before. I am aware of the 8k record size limit. Any info is apprecieated. ...more >>

query ADSI from SQL syntax ... ?
Posted by Petr SIMUNEK at 12/12/2003 7:46:46 PM
(W2K server SQL2000) In stored procedure this works perfectly: SELECT * FROM OpenQuery( ADSI,'<LDAP://DC=camo,DC=comr>;(&(objectCategory=Person)(objectClass=user)(s AMAccountName=john.doe));name, adspath;subtree') What is the correct syntax to put a Input parametr in place of user name ...more >>

Select statement used to create view question
Posted by RD at 12/12/2003 6:37:00 PM
I'm simplifying the statement, it works as follows so far. Select TableA.FieldA , (select fieldB from TableB where TableB.FieldA = TableB.FieldB) as FIELDC from tableA where tableA.ID = 99999. This works, I get the values from FieldA I need as well as FieldC What I now need is to get a fie...more >>

Using a User defined function returning a table in a subquery
Posted by Alistair Welchman at 12/12/2003 5:37:33 PM
I have a user defined function taking a UUID as a parameter and returning a table CREATE FUNCTION dbo.fnDeploymentGetAllInComing ( @DeploymentID uniqueidentifier ) RETURNS TABLE AS RETURN select * from Messages where DeploymentID = @DeploymentID and Messages.Direction = 0 -- and b...more >>

Number of pages used in database file
Posted by Artem Kliatchkine at 12/12/2003 5:20:13 PM
Hi All, I would like to know number of used pages in a database file (not in the whole database!). Such information is returned by DBCC SHRINKFILE command ( ... CurrentSize: The number of 8-KB pages the file currently occupies. ... UsedPages The number of 8-KB pages currently used by t...more >>



online database using SQL and ASP.net
Posted by Peter at 12/12/2003 4:53:22 PM
We have built an online contact manager. We are trying to figure out how to accomplish the following: Please keep in mind that this is web-based. When you type in the box to find a client is it possible that as you are typing it will narrow your search. I have seen this done using JS, but...more >>

view of two table with two different indexes
Posted by JJ Wang at 12/12/2003 3:58:53 PM
Hi, I have a view that is a union of two table, same table, but one in the active database, the other in the history database. we are trying to improve the query speed on the view, so we modified the indexes on the history data set table. Just wondering that whether we need to modifie...more >>

Constraint violation issue
Posted by Alex Agranov at 12/12/2003 3:55:05 PM
I have a table with a foreign key constraint. If I UPDATE the table on just the foreign key with a wrong value, I get the constraint error from Query Analyzer, but if I UPDATE several columns including the foreign key at a time, the row updates without generating the error. This is very strange ...more >>

Problem with order of processing
Posted by Harry Leboeuf at 12/12/2003 3:55:00 PM
Hello, I'm filling up a table to feed a Metrics Manager system from Cognos. For one of these staging tables i'm using the below insert instructions. My problem is that, when looking at the table, after the insert, the records are not in the 'logical' order that the instructions have been perfo...more >>

Error Trapping
Posted by Darren at 12/12/2003 3:07:30 PM
How can I make a trigger ignore an error and continue on finishing the process that caused the trigger. ...more >>

Sub-Query
Posted by SFRATTURA at 12/12/2003 2:31:16 PM
SQL 2000 I have a table of "Newspaper Ads". 4 columns. ClientID, AdvertiserID, AdID, AdText. --ClientID, Advertiser ID, ADID is primary key-- I want to return the Max(AdID) for each CLientID, AdvertiserID. Easy enough. -----select Max(AdID), ClientID, AdvertiserID from ADS group by ...more >>

Column Verification
Posted by kgs at 12/12/2003 2:25:33 PM
I know table name as 'authors' is there any function which can tell me whether au_xname is a column in the table. can i use this function safely. SELECT COLUMNPROPERTY( OBJECT_ID ('authors'),'au_xname','PRECISION') ...more >>

iterate all triggers in db and determine if enabled
Posted by Eric Hall at 12/12/2003 2:12:51 PM
Folks - SS 2000 Standard SP3. Where can I find whether or not a trigger is enabled? I would like to iterate through all triggers for a given db and determine if they are enabled or disabled. Can someone point me to where this nugget of data is stored for each trigger? Thanks! Please re...more >>

Can't Find Query Menu (G)
Posted by Fox at 12/12/2003 2:08:13 PM
OK, books online tells me to make a selection from the QUERY menu. I was thinking this meant in the QUERY analyzer. However the REPLACE option is not there. It also said to try the FIND option. There is a FIND option but it is GREYED out. I have little experience here and it was a while back. ...more >>

RAC chat tonight
Posted by Rufus T. Firefly at 12/12/2003 1:58:50 PM
If you have no big plans and/or are up late tonite, you can chat/flame with the guys at RAC (www.rac4sql.net). We will begin sometime between 9:00-9:30 PM pst/ 12:00-12:30 AM est. We're using Yahoo chat so if you don't have it you can download it from yahoo.To participate send your yahoo handl...more >>

Another table design question
Posted by Chris Strug at 12/12/2003 1:38:02 PM
Hi, Sorry if this is something I should know but.... In an example database I have a stock table. Each item of stock has a reference and so on. However, each item of stock can be in one of two states - empty or loaded. If a item is empty it requires different information (and thus different...more >>

Indexing Problem
Posted by Adam Arsenault at 12/12/2003 1:21:07 PM
Hi i am currently working on the indexs in an ad system that records the clicks and displays for all the ads show on our website. The table for recording the ads looks like this: CREATE TABLE [dbo].[tbl_sitebannercounter] ( [siteBannerCounterID] [int] IDENTITY (1, 1) NOT NULL , [currentDa...more >>

How about "SET DEADLOCK_PRIORITY HIGH"
Posted by Kong Li at 12/12/2003 12:14:06 PM
env: SQL 2000 SP3. Three questions: 1. BOL indicates "SET DEADLOCK_PRIORITY LOW" specifies that the current session is the preferred deadlock victim. I was wondering if there is any way to do the reverse, i.e., specify the current session NOT be the preferred deadlock victim. Yes, I...more >>

Case statement question newbie
Posted by kda at 12/12/2003 12:06:05 PM
I have the below query: SELECT dbo.cp_RM00101.USERDEF1, dbo.cp_RM00106.Email_Recipient, dbo.cp_RM00101.CUSTNMBR FROM dbo.cp_RM00106 INNER JOIN dbo.cp_RM00101 ON dbo.cp_RM00106.CUSTNMBR = dbo.cp_RM00101.CUSTNMBR LEFT OUTER JOIN dbo.vwNextDayBatchDDC ON dbo.cp_RM00101.CUSTNMBR = dbo.vw...more >>

uppercase?
Posted by LL at 12/12/2003 12:01:12 PM
Hi, I have a "LastName" field, defined as string. How to get it from DB as the firstleter uppercase? Select FirstLetterUCase(LastNeme) from tUser? Thanks, ...more >>

Datetime problem
Posted by Darren at 12/12/2003 11:54:42 AM
I am filling a date field using GetDate( ), but when I query by this field, I have a date a a string, for the life of me I cannot get it to find the record, can some please help ...more >>

using ADOX to migrate from Access to SQLServer
Posted by Dhar Rawal at 12/12/2003 11:50:21 AM
Hi, I am using ADOX to migrate tables from Access to SQL Server. Migrating most column attributes such as type, size, precision etc. is straight forward. But I cannot figure out how to migrate the "Description" property of a column from Access to SQL Server It seems I can get the "Descrip...more >>

what is the best program to manage code snippets?
Posted by haode at 12/12/2003 11:45:13 AM
What is the best program to manage code snippets? The program should support unicode(Korean). Thanks. ...more >>

Insert from an SP
Posted by Prashanth at 12/12/2003 11:25:19 AM
Hi, How do you insert the output from the Stored Proc into a temp table. -PK ...more >>

Identification of a primary key/foreign key
Posted by Jon Turner at 12/12/2003 10:49:42 AM
what kind of query can I use to determine if a column participates as a primary/foreign key in a table. Many thanks and seasons greetings. ...more >>

Roles Pblm
Posted by Prashanth at 12/12/2003 10:41:51 AM
Hi, How do i list all the objects that have been given grant privileges for a given Role. -PK ...more >>

bug in SQL Server
Posted by Dale Fox at 12/12/2003 10:40:43 AM
First question: Why does MS feel it is acceptable to charge a developer to sumbit a bug report? Secondly, in the event that MS employees are reading this, below is a script that demonstrates an error in MSS 8.0. A user defined data type that has a default bound to it fails to supply a d...more >>

Extract data from own data
Posted by Marcelo Roza at 12/12/2003 10:36:10 AM
I've in my db one table that contain one field that have inside him many information that are subduvide for a bar ( | ). So I need read this field and create for each ocurrency one new record in a other table, like this; Sample: I've this: ID EVENT VALUE 0000...more >>

selecting missing IDENTITY values
Posted by Robert Taylor at 12/12/2003 10:36:01 AM
I need to know if there is a way to find the the id of records that have been deleted from a table. For example, I have an ID column with values 1-60 and 65-100, but 61-64 have been deleted from the table. Is there some trick that I can use to count the number of records missing? Please, no ...more >>

Scedule stored procedures?
Posted by Peter at 12/12/2003 10:13:51 AM
Group, how can i Schedule a stored procerure to be run at a specified time? Regards /Peter ...more >>

ISNULL, CONVERT AND spaces
Posted by Robert Taylor at 12/12/2003 10:06:35 AM
I'm generating and emailing a .csv file using SQL mail. My problem is how to eliminate NULLs in the data and not populate the .csv file with " " data instead. My code is below.... select isnull(convert(nvarchar,dateTimeEnrolled, 101),'') as [Enrollment Date] from ... The problem I'm encou...more >>

How to get current database name? (or ID)
Posted by ®arko Jovanoviæ at 12/12/2003 9:54:13 AM
thanx ...more >>

xp_sendMail @query syntax
Posted by kdabda at 12/12/2003 9:46:15 AM
I am trying to use the @query in xp_sendMail and put a variable (@Store) that is filled in a cursor. Please see below. I get error by the + in @query line. I tried putting the query in the sp_QueryStoreReceipentMessage, right in the @query line and it gave me the same error. Thanks, OPEN @MyC...more >>

Are cross-server queries possible?
Posted by Mike at 12/12/2003 9:39:09 AM
All, I am trying to run DTS packages to create a 1.6 million row table on a server in Arizona and transport that result set to my database in Oregon. I am getting TCP/IP errors that the network folks are investigating. In the meantime, I am somewhat stuck because I need that data. (It is ...more >>

Check it or catch it? The PK constraint conflict.
Posted by Welman Jordan at 12/12/2003 9:34:16 AM
Hello, If we insert two records with the same PK value, there'll be a conflict of PK constraint. In order to handle this, should I, 1. check it before inserting it If not exists(SELECT * FROM tab WHERE pkval = @pkval) INSERT ... Else .... or 2. catch it in the application ...more >>

Strange entry in Stored Procedure profiler trace
Posted by Michael at 12/12/2003 9:26:04 AM
Hello Sorry for the long-winded post I have been expirimenting with the profiler utility and I am curious about some of the entries that appear in the trace log. Essentially, I'm running a C++ application that uses an ADO command to iteratively execute (100 times) a stored procedure. While ...more >>

Convert 'True' to 'ok'
Posted by Otto Miros at 12/12/2003 9:18:46 AM
Hi, is it possible to convert an boolean 'True' to String 'ok' in one selection phrase. Example ti_b is a boolean table colum "select ti_b from table1 where iiD = 1" returns 1 (True) I need as return value string "ok". Thanks Norbert ...more >>

Another Trigger Q?
Posted by Darren at 12/12/2003 9:16:26 AM
How Can I test Updated( ) using a variable as the column name? ...more >>

(rowlock xlock) Lock hinnts
Posted by Sai at 12/12/2003 9:10:50 AM
I want to have an exclusive lock at row level for a sql statement in a transaction,to accomplish this I used (rowlock xlock) lock hint on SELECT statement,surprisingly it is not working for some of the tables is there any restriction using this hint?? Here is an example to reproduce...more >>

SQL sending email
Posted by D Mack at 12/12/2003 9:06:22 AM
The following trigger gets a successful syntax check but generates an error when run create trigger [emailsend] on root.ae_a_aemail_ for inser a if (select actiontaken from root.ae_a_aemail_a) = 'Y exec master.dbo.xp_sendmail [@recipients = contactmc], [@subject = 'Your customer request'] [@...more >>

Batch Processing Help
Posted by Chris Gallucci at 12/12/2003 8:48:47 AM
I need to write a sp that meets the following requirements... 1. Select the TOP n records. 2. Mark the selected records to prevent other threads from selecting this group. 3. Prevent other threads form selecting this group while this action is occurring. 4. Return the selected records to the c...more >>

running asp through xp_cmdshell
Posted by john.majewski NO[at]SPAM sitesbyjohn.com at 12/12/2003 8:47:33 AM
I need to run an asp page from sql server. I got it to work using a stored procedure which runs xp_cmdshell to open a vb-script that opens the asp page. BUT, it only worked a few times. Now, whenever I run the stored procedure (through query analyzer) nothing happens. The vb script still ...more >>

SQL Stored procedure return incorrect results
Posted by Jorge Luis Ribeiro at 12/12/2003 8:25:33 AM
My name is Jorge and I am having a problem with a sp that I could call it "sinister". I developed a SP that reads information and parameters in several tables to construct a temporary table that I am gonna insert data to be kinda a log table. When I run that Sp via Query Analyser its res...more >>

SQL Server Money Type
Posted by klj_mcsd NO[at]SPAM hotmail.com at 12/12/2003 8:23:06 AM
I am multiplying 2 column. One is a money type and the other is decimal Now let's say I multiply 8.22 * 5. I get 41.1. How can I alter my SQL to get 41.10? Or even better $41.10? I read you can put a dollar sign in front of numbers. Thanks for your help...more >>

How authenticate with sysusers ???
Posted by lubiel at 12/12/2003 6:57:49 AM
Hello, Someone knows the way to validate a username & password with sysusers ??? I am using SQL Server 7. I am doing something like is: SELECT * FROM sysusers WHERE name = @LOGIN AND PASSWORD = @PASSWORD; but i can not find in sysusers a field to 'password', so, what field i need ...more >>

add character return to store procedure result
Posted by kdabda at 12/12/2003 6:31:08 AM
this was kind of a hard question to search for an answer for!! but I don't think it should be difficult I have a stored procedure that passes a @emailMessage to a another sp to send an email. Below I go through a cursor concatenating together information to @emailMessage. I however would like ...more >>

list of databases that contain a certain table
Posted by Lisa Pearlson at 12/12/2003 5:46:03 AM
Hi, How do I list all databases that have a certain table name in a field? Obviously some databases will not even contain a certain table name, and those that do, may not contain the certain filed. So what I want is create some databases, that contain a table "system" with a column "type"...more >>

Return value from executable via stored procedure
Posted by jasonl22 NO[at]SPAM yahoo.com at 12/12/2003 5:26:48 AM
I need to return the value calculated via an executable back to my stored procedure. Here is some code based off my actual code: declare @cmd varchar(100) declare @v_in varchar(6) declare @v_out varchar(64) set @v_in = '123456' set @cmd = 'c:/abc.exe ' + @v_in --abc.exe returns a 64 di...more >>

sql programming help
Posted by Kim at 12/12/2003 4:01:10 AM
H I have a set of answer from a survey in a table. There are questions with multiple answers and I want to parse them out and count them. These questions are mostly from checked boxes and radio buttons. I need help writing a procedure to do so. Below I put in sample test data, what I would lik...more >>

Propertyquestion on sysobjects
Posted by hansje at 12/12/2003 3:00:47 AM
Hi there, I found the next statement in an article: SELECT name FROM Northwind..sysobjects WHERE type = 'U' AND (objectproperty(object_id(name), 'tablehasidentity') = 1) When I run this it returns only the table dtproperties. However, when I look in Northwind I find more usertables...more >>

Row Level Exclusive Lock
Posted by KB at 12/12/2003 2:39:31 AM
How can i explicitly accure row level exclusive lock, i found about row level table and page lock but is it possible to have row level exclusive lock if yes how...more >>

Storing billion and images in SQL Server 2000
Posted by Belee at 12/12/2003 2:11:11 AM
How can I store lets say 999 billion or a trillion (999,999,999,999,999.99) in SQL Server 2000 database, what data type to use for this. And secondly how can I save employee photos in my database in SQL Server 2000 as can be done easily in Microsoft Access. I need help....more >>

difference between "20" and "120" in convert
Posted by info NO[at]SPAM analysisandsolutions.com at 12/12/2003 2:08:26 AM
Hi: In my research about CONVERT(), I noticed the date format I'm interested in can be expressed using two different style arguments, 20 and 120, but the documentation doesn't really explain the difference between them. Sample queries: SELECT convert (char(19), d, 20) FROM t; SEL...more >>

iso as default date display format
Posted by info NO[at]SPAM analysisandsolutions.com at 12/12/2003 1:51:11 AM
Greeetings: After spending several hours going over the manual and newsgroup archives, I'm not much closer to figuring out the solution to my question. I have a feeling the exact solution I'm looking for doesn't exist, but I hope you can help by proving me wrong, please. Quick background, ...more >>

INSERT in a VIEW
Posted by Steve at 12/12/2003 1:41:53 AM
Is it possible to INSERT a tuple in a VIEW that contains data from more than one table? A message comes up and says: [View or function 'CustomerView' is not updatable because the modification affects multiple base tables.] ...more >>

Security Role
Posted by Steve at 12/12/2003 1:41:33 AM
Can anyone give a security role I couldn't define a security role by the following commands: addrole sp_addrolemember sp_addsrvrolemember Would you please give a full sample? ...more >>

SP template Change
Posted by Sarmad at 12/12/2003 12:52:10 AM
Hi, I want to add some code to the default Stored Procedure template so that when developers createa a new SP would have some code already added. Anyone know where its stored and how to edit it? Thanks in advance. Regards, Sarmad...more >>


DevelopmentNow Blog