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 > march 2006 > threads for friday march 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

Nested Query Sum Group By Month
Posted by Jason Wood at 3/24/2006 9:24:24 PM
I am trying to accomplish this GrossMargin Sumof31000 Year Month 733747.10 x 2006 1 745466.90 x 2006 2 792383.03 x 2006 ...more >>

Get collation list
Posted by christof at 3/24/2006 4:49:13 PM
Is there a way do programmable get a Collation list from server? Tried this: [C# code] using Microsoft.SqlServer.Management.Smo; Server srv = ...; DataTable collations = srv.EnumCollations(); but it returns an empty DataTable, i wish to fetch it somehow. SELECT * FROM ::fn_helpcollat...more >>

Problem with multiple resultsets
Posted by indee at 3/24/2006 4:09:34 PM
How can I populate a variable in a stored procedure without returning the recordset from the exec statement? DECLARE @temp float DECLARE @rv int DECLARE @MyCursor CURSOR SET @MyCursor = CURSOR FAST_FORWARD FOR Select XOID FROM tblSalesOrder_XO WHERE SOID = @id OPEN @MyCursor FETCH NEXT ...more >>

blank query window- how to get?
Posted by mrmagoo at 3/24/2006 4:07:20 PM
In Sql Server Query Analyzer, to get a blank query window, it seems that I must first edit an existing stored procedure, at which point the "New window" button is enabled. Is there a way to get an empty window without first having to edit another query? If I launch Query Analyzer, I have an em...more >>

Deadlock help on single table
Posted by McGeeky at 3/24/2006 3:27:16 PM
I am experiencing a large volume of deadlocks with a stored procedure I have written. The stored procedure only ever accesses one table. First it performs a couple of selects to check if a record exists or not and if it doesn't then it tries to insert it. Its on the insert that I get the de...more >>

Import/Export wizard
Posted by helpful sql at 3/24/2006 3:24:15 PM
Hi all, I want to copy data from one table and insert it into a view using Import/Export wizard. But the wizard is not showing me my view in the dropdown list for destination. So is this possible? If so, how? Thanks in advance. ...more >>

Help with counting Query
Posted by Bob and Sharon Hiller at 3/24/2006 2:50:13 PM
I am trying to find a query to count rows with multiple conditions. I have files which are suffixed with -R and then a number from 1 to 3 and then two digits 00-14. the field is char i.e.: -R101 -R102 -R114 -R201 -R302 I need to determine how many 101, how many 102, etc through 114 ...more >>

How to delete records on dependent tables? Thank You.
Posted by Miguel Dias Moura at 3/24/2006 2:35:54 PM
Hello, I am creating my first procedures in SQL using SQL 2005. I have 3 tables, with the following columns: Surveys - [SurveyId](PK) and [SurveyName] Questions - [SurveyId](FK), [SurveyQuestionId](PK) and [SurveyQuestion] Answers - [SurveyQuestionId](FK), [SurveyAnswerId](PK) and [Survey...more >>



Weird problem with temp tables
Posted by Eric Caron at 3/24/2006 12:50:53 PM
Hi all, I'm using SQL Server 2000 and I have a strange problem with a temporary table I'm creating in a stored procedure. I use the following code: SELECT * INTO #TempTable FROM tblUsers ALTER TABLE #TempTable ADD RecPosition INTEGER IDENTITY This creates a copy of the tblUsers table an...more >>

DTS Export Wizard
Posted by Elliot Rodriguez at 3/24/2006 11:31:24 AM
Is there a way for me to globally select "Delete rows in destination table" when performing an export via the Export Wizard? It is not obviously visible to me, and I have a great deal of tables. I've been clicking "Edit" for each one, and this isnt practical for obvious reasons. Can anyo...more >>

Dynamic IDENTITY seed
Posted by Goran Djuranovic at 3/24/2006 11:10:45 AM
Hi all, Does anyone know if it is possible to set identity seed using a = variable, and if not what is the alternative? I would not like to use = Dynamic SQL. I cannot get any of the following to work. For example, ---------------------------------------------------------------------- Declar...more >>

Iterate calls to a stored procedure from within a stored procedure
Posted by indee at 3/24/2006 11:05:50 AM
Here's what I'm trying to accomplish: Each record returned by a single select statement within a stored procedure must be sent as a parameter to another stored procedure, and a resultant field is to be added to a local variable for output in the first procedure. Something like: SELECT SU...more >>

help with recursive query
Posted by mateo at 3/24/2006 10:54:08 AM
I have a group table build like this: CustomerGroupId int CustomerGroupName nvarchar CustomerGroupParent int and a user table like this userId int userName nvarchar CustomerGroupId int .... now i've written a recursive query where i pass a groupId and i get all SubGroups WITH C...more >>

Populate Normalized Data!!!!
Posted by Vai2000 at 3/24/2006 10:53:15 AM
Hi All, I have a data file with delimiters that contains data for relational table. How can I populate these tables with the data file without writing much of code. The trick is these tables have Constraints PK, FK and identity fields. The ID From Table1 is the FK in Table2.... BCP with format ...more >>

check field
Posted by js at 3/24/2006 10:29:41 AM
Hi, how to find out what table, field contain "mysearchtext" in side? Thanks a lot. ...more >>

Query Help, Efficient Exclusion
Posted by JDP NO[at]SPAM Work at 3/24/2006 10:28:37 AM
I need to have in my staff_rank table each staffname and region, but it's OK to have a duplicate staffNames as long as the region is different. Please note that, I can't correct the problem of the same staffName having additional entries with the same region code, there are good reasons this is...more >>

sp_refreshview Error Handling
Posted by JSzymanski at 3/24/2006 10:12:02 AM
I am using the following code in a stored procedure to refresh a selected group of views (for which the underlying tables have changed): SET XACT_ABORT OFF EXECUTE @spErrNo = sp_refreshview @fullViewName IF @spErrNo <> 0 or @ERROR<> 0 PRINT 'ERROR: ('...more >>

Rounding
Posted by Brian Shannon at 3/24/2006 9:57:08 AM
I am trying to round values to the nearest $5. I work in the casino industry and we offer patrons cashback on thier play. Let's say someone earns $42 cash back. I need to send them an extra check for 25% rounded to the nearest $5. $42 * 25% = 10.5 which I need to round to $10 $53 * 25% ...more >>

TSQL or CLR? Interested in hearing opinons...
Posted by Charlie NO[at]SPAM CBFC at 3/24/2006 9:44:15 AM
Thanks, Charlie ...more >>

Which system table tells you if a column is primary key?
Posted by Charlie NO[at]SPAM CBFC at 3/24/2006 9:41:52 AM
Thanks Charlie ...more >>

counting child rows?
Posted by HockeyFan at 3/24/2006 8:53:02 AM
I've got a query where I have to find all messages for a particular topic, and then I need a count of all child messages for each message. Here's what I have so far: ALTER PROCEDURE [dbo].[udForumTopicMessageByForumTopicID] @ForumTopicID int AS SELECT A.ForumTopicMessageID AS "F...more >>

moving a db from 2005 to 2000
Posted by Edie Richardson at 3/24/2006 8:01:02 AM
I have a vendor who uses sql server 2005 but we are currently using 2000 sp4. He has sent me a mdf, a ldf file and a bak file. I would like to get this on my ss2k server. What is the best way to do this? I've tried restoring the bak file but it tells me that there is a compatibility pro...more >>

Newbie question Local Temp Tables vs Global Temp Tables
Posted by Stephen K. Miyasato at 3/24/2006 7:32:26 AM
I'm trying to find the distinction between Local temp tables vs. Global Temp Tables. Seem that Global temp tables have greater persistence when using a stored procedure with a returning select statement. Question: Are any of the #tempLocalTable or ##tempGlobalTable accessible from other ...more >>

Table creation warning concern
Posted by Steven at 3/24/2006 6:41:02 AM
I am utilizing the June 2005 PPEL and I am logging exceptions to a SQL Server 2000 database. In the PPEL installation there is a script named LoggingDatabse.sql that creates the necessary table and stored procedure. When I execute this script I am getting the following warning: Warning: The...more >>

Exclude child nodes i Select
Posted by Senna at 3/24/2006 6:01:02 AM
Hi Have this code, http://code.doria.se/?c=21, that I found at CodeProject.com. (http://www.codeproject.com/cs/database/Trees_in_SQL_databases.asp) To the Node table I have added a IsActive column, that you can see is being used in the last query. select c.* from Node n, Tree t, Node ...more >>

LIKE and variables
Posted by Enric at 3/24/2006 3:54:01 AM
Dear all, I can't work out with this query: declare @var char(20) set @var = 'look%' select name from table where field like @var No return rows when there is a lot Any input or advice would be very appreciated. -- Current location: Alicante (ES)...more >>

Cascading stock values?
Posted by Mike Owen at 3/24/2006 1:58:03 AM
Hi, I have a database containing products, the tables of which are basically as follows: table_PRODUCTS -->(products may or may not have colours) table_PRODUCT_Colours -->(colours may or may not have sizes) table_PRODUCT_Colour_Sizes - The tables currently hold stock values at all 3...more >>

REQ: Bulk XML Update and Insert Performance Advice
Posted by Mark S. at 3/24/2006 12:03:34 AM
Hello, I've been asked to rebuild an app. The app in question is a real time stats engine. It uses C# to loop over each stat and send it to a SQL Server 2000 SP3 stored procedure. There the stat is parsed into it's different parts and stored in 15 different tables using UPDATE and INSERTs. ...more >>

DISTINCT OR GROUP BY
Posted by Savas Ates at 3/24/2006 12:00:00 AM
I have some records in my Sql Db. There are some duplicate record in my email and adsoyad fields Email Adsoyad a@a.com Savas a@a.com Pele b@b.com Savas c@c.om Ilim d@d.com Hasan d@d.com Hasan I want to eliminate email address whic...more >>

Best way to check a bunch of variables passed to a SP
Posted by Robert Bravery at 3/24/2006 12:00:00 AM
HI all, If I hav a SP like CREATE PROCEDURE addclaim @ctkey int, @headerid int, @cpkey int, @brkref varchar(25), @DET varchar(100), @Status tinyint, @peril int, @cause int, @resc int, @fault int, @polsection int, @Assid int AS What is the best way to check that a value ...more >>


DevelopmentNow Blog