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 > february 2007 > threads for friday february 16

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

Creating cols out of rows
Posted by Ant at 2/16/2007 11:54:00 PM
Hi, below is a not so elegant attempt at displaying 5 rows into a column for each. I won't know how many rows there will be for the query so this must be calucualted on the fly, thus I have used a cursor to do this. Two questions. 1> Why is the concatinated string being used as the select ...more >>


Dynamic param substition - ideas?/suggestions? TOUGH ONE I THINK.
Posted by jobs at 2/16/2007 8:03:40 PM
Hello. I have a application that will accept parameters from users. I'd like to give them a way to build dynamic parameters that substitute strings with formated dates allowing them to define Parms that are date smart. Say they define some sql that results in the desired date and format.....more >>

Best way to ensure a non negative
Posted by PokerMan at 2/16/2007 7:51:52 PM
Hi guys I have a few tables to do with accounts and balances. I will never want a negative value in balance and so as well as front end code protection i would like to do a double check by making the database never allow such a occurence. I update one table which fire a trigger to deduc...more >>

Occasional error when reading from table that updates very often
Posted by nsf at 2/16/2007 6:02:38 PM
I have a single table that contains about 2000 records of asset (vehicle) position information. The data is fed in quite often as each asset's position is updated. I would guess that each asset might update it's position as often as once every four seconds. I have a view with a simple se...more >>

How to drop temp table?
Posted by john_c at 2/16/2007 5:24:10 PM
In SQL Server 2005, I'm running this code with no errors: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo]. [#mytmp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[#mytmp] but when I run this code, it says #mytmp already exist: CREATE TABLE #mytemp ( s...more >>

Retrieve Table Names from View...
Posted by Brett Davis at 2/16/2007 5:00:16 PM
Hello... I want to be able to have a T-SQL script that when a name of a view is passed to it that the query then generates a result set that lists ALL underlying tables and views within the view name that was passed. So basically I want to see what tables and other views that referenced fo...more >>

spain
Posted by Carmen Ruiz Peña at 2/16/2007 4:40:37 PM
Alguien habla españoool???? ...more >>

Problem with self join
Posted by Derek at 2/16/2007 3:14:05 PM
I'm trying to create a view that will display the contents of a table in a more user friendly way. I have tried may different variations of self joins and subqueries, but I'm striking out. Here is an example of the table/data. RECEIPT_LINE_QTYS table KEY RECEIPT_NUNMBER LINE_NUMBER QU...more >>



select statement in sql 2000
Posted by Ryan at 2/16/2007 3:11:18 PM
providing the following table structure: CREATE TABLE [dbo].[PRODUCT]( [ProdID] [nchar](10) NULL, [Cat] [nchar](10) NULL, [Product] [nchar](10) NULL, [Dept] [int] NULL, [Qty] [int] NULL ) insert into PRODUCT values('PR1','Cat1', 'Fruit', 1, 15) insert into PRODUCT values('PR1',...more >>

How to handle Errors
Posted by HLong at 2/16/2007 12:47:02 PM
I would like to know the best way to handle errors when creating a connection to a DB in Vb 6.0. What will be the best way to handle the errors? Should I set both the connection and recordsets objects to "Nothing", if an error ocurrs? Shoud I try to close them first, and then set them to noth...more >>

PROBLEM WITH ISNUMERIC INTO CASE STATEMENT
Posted by Gus at 2/16/2007 12:39:39 PM
Hi guys, Could you please tell me why this script return me an error when @var1 is not numeric. DECLARE @var1 CHAR(11) SET @var1 = 'R0002345432' SELECT CASE ISNUMERIC(@var1) WHEN 0 THEN @var1 WHEN 1 THEN CONVERT(INT,@var1) END Server: Msg 245, Level 16, State 1, Line 5 Syntax err...more >>

Reporting on non-existent data without UNION
Posted by Brent Stroh at 2/16/2007 11:44:48 AM
I'm trying to report on record counts meeting a certain criteria. If there aren't any, I'd like to see a row with all zeroes for the 8 weekly columns. The only way I've been able to do it so far is to use constants and UNION. I'd like to SELECT classification, but force the inclusion of all va...more >>

WHERE colName IN (@Variable)
Posted by Hitesh at 2/16/2007 11:42:08 AM
Hi, I have a query like this: USE pubs DECLARE @au_fn varchar(1000) SET @au_fn = " 'Johnson', 'Marjorie', 'Cheryl', 'Michael', 'Dean' " SELECT * FROM Authors WHERE au_fname in (@au_fn ) How can I assing multiple values to a variable and use it WHERE colName IN (@Variable) type of claus...more >>

Stored procedure slowness
Posted by sqlboy2000 at 2/16/2007 11:16:05 AM
All, This one has me scratching my head. There's a stored procedure in our main web application that is timing out a couple of times a day. When I go to the server and run it in management studio, it returns it's result set almost instantly. I look at the sql being submitted to the server in ...more >>

How to convert select query result into a comma/semi-colon separated list
Posted by donet programmer at 2/16/2007 10:02:55 AM
Is it possible to store select query result into a varchar variable with comma or semicolon separated list. e.g. I want to store results from following query Select Email from tbl_Users into a variable @EmailList i.e. following query result Email test@test.com test1@test.com t...more >>

using IronPython stored procedures in SQL Server 2005?
Posted by Victor Ng at 2/16/2007 9:19:34 AM
Has anybody had luck getting IronPython assemblies to work in SQL Server 2005? I can't seem to find a definitive answer on whether or not this is possible. vic ...more >>

SSIS / DTS The dependency EnvDTE could not be found ??
Posted by jobs at 2/16/2007 9:10:36 AM
I have a simple SSIS script Task.. suddenly I'm getting warningss like this: SSIS The dependency EnvDTE could not be found. Warning 2 The dependency 'Microsoft.SqlServer.VSAHosting' could not be found. Warning 3 The dependency 'Microsoft.SqlServer.DtsMsg' could not be found. I also ma...more >>

Linked Server Execution Slow
Posted by prefersgolfing at 2/16/2007 9:06:49 AM
I am running a query across a linked server and it is running drastically slow. Is there a way to speed it up or are there settings that bog down the execution time. Which tools would best suit me me to troubleshoot performance issues. Thanks ...more >>

AWE in Windows X64 SQL 2005
Posted by Nitin at 2/16/2007 8:38:40 AM
Do we need to enable AWE in Windows X64 for SQL 2005? I have SQL 2005 on X64 with 34 GB of Memory. Thanks in advance Nitin Any whitepaper on configuring memory management on X64 is highly appreciated...more >>

count nulls
Posted by James at 2/16/2007 8:13:08 AM
I have a table similar to this: appnum units 1 1 1 4 2 null 2 null 3 2 3 null 3 1 I would like to be able to count the number of units = 1 and group by appnum. appnum 2 should return 0 result set ...more >>

Trial versions of MS software require to buy programs just to extract?
Posted by maruk2 NO[at]SPAM hotmail.com at 2/16/2007 7:59:15 AM
I downloaded 90-day trial version of Visual Studio 2005 but this thing is only in .img file format and Microsoft does not provide any extraction utility for .img files. According to this page (related to another software with at least alternative.iso format) http://msdn.microsoft.com/vstudi...more >>

querying for stored procedure code in sql server 2005
Posted by Victor Ng at 2/16/2007 7:56:37 AM
Is there a way to encode nvarchar to UTF8 so that I can retrieve stored procedure code from SQL Server? the following SP doesn't work - I get an error like: "Msg 245, Level 16, State 1, Procedure spGetDDL_SP, Line 14 Conversion failed when converting the nvarchar value " --- ALTER PROCED...more >>

Row level locking
Posted by JayKon at 2/16/2007 7:53:02 AM
I understand that SQL Server 2000 defaults to row-level locking and the query optimizer will upgrade that to page, or table level locks, when it thinks it's approporiate. However, I have found refernces to the OPTION clause of the SELECT statement that says I can tell the query optimizer it mu...more >>

Only select records with a net value <> 0
Posted by Steve at 2/16/2007 7:48:38 AM
Ok, I know this should be simple but I'm having a lot of trouble making this work... The file I'm trying to query is a historical order file. Any order entered or changed has a record, so if somebody calls in on Monday and orders 10 items of PM123 a record is inserted with an order_line_it...more >>

Saving historical data concatenated
Posted by Earl at 2/16/2007 7:39:35 AM
I'm adding invoicing capability to an existing app and before I built any tables, I have been doing a bit of reading on the need to store historical information for the invoice. It has been pointed out, for example, that after output, perhaps a customer's name or address might change and thus ...more >>

Need a T-SQL Expert
Posted by Sean at 2/16/2007 6:29:02 AM
Could someone, please review my posting dated 2/13/2007 subject is 'SELECT Query in SQL Server 2000' and help me out....more >>

Error handling
Posted by Ramesh Subramaniyan at 2/16/2007 2:47:13 AM
how to handle if select has error consider this scenario i have created one table create table test(testid int , description varchar(50)) i created sp create proc p_test as select * from list i have renamed table name as table 1 how t o handle this error insi...more >>

Calling proc using sp_executesql
Posted by jonas.berling NO[at]SPAM knowit.se at 2/16/2007 2:35:20 AM
Sorry for this probably stupid question, but "one has go to ask to learn"... I'm trying to call a stored procedure using exec sp_executesql. It look something like this: CREATE PROCEDURE sp_myProc(@txt) AS ....do something simple here I then try to call cp_myProc like this: DECLARE @...more >>

Getting last accessed table from the database
Posted by jack at 2/16/2007 2:05:20 AM
Hi all i want to know is there any way thought which i can get the last accessed table from the database along with the time of access im using sql2000 Thanks for replying me ...more >>

MINUS
Posted by Selvarengan at 2/16/2007 12:08:00 AM
select F1 from T1 cul minus select F1 from T1 cul where F2 = 100; This Query is in Oracle , I need common Query which will run on Both Oracle 9I and SQL Server 2000...more >>

CLR stored procedures in TableAdapter: no fields are populated?
Posted by Steven Spits at 2/16/2007 12:00:00 AM
Hi, While experimenting with CLR stored procedure, I discovered it won't populate the fields in the TableAdapter, like a normal stored procedure. Why is this? GetClientList = normal stored procedure GetClientListTest = CLR stored procedure Both contain the same SQL, "SELECT * FROM Clie...more >>

Deadlock issue
Posted by Michael C at 2/16/2007 12:00:00 AM
I'm getting an error "Transaction (Process ID 59) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.". I've written a test app to reproduce this error and can reproduce it easily. In fact it happens twice as often as it is ...more >>

Primary Keys and Clustered Indexes
Posted by Kevin Eckart at 2/16/2007 12:00:00 AM
Since I have primary keys on all tables is it still recommended that I have clustered indexes on those tables as well? Thanks, Kevin ...more >>

Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1.
Posted by Usarian at 2/16/2007 12:00:00 AM
I am getting this error: Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1. Here's the code: set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROC [dbo].[sproc_SCMPostTicket] (...more >>

DTD XML sql server 2000
Posted by Aneesh at 2/16/2007 12:00:00 AM
Hi, Here is the script i am having DECLARE @nSQL VARCHAR(8000) DECLARE @hdoc int SET @nSQl = '<?xml version="1.0" encoding="UTF-8" ?> <XML DocSize="123k" > <Category AppliedTo="Software Engineer" name="Location Code"><![CDATA[United States of America]]></Category> <Category AppliedT...more >>

Recherche logiciel : Documentation et dependences
Posted by Gislain at 2/16/2007 12:00:00 AM
Bonjour, Je recherche un logiciel pour générer de la documentation et naviguer dans le modèle de base de données. A je jour, le seul produit qui ressort en permanence est celui de Red Gate's, mais il doit bien en exister d'autres ????? Merci de votre aide. Cdt. Gislain ROCHE ...more >>

Temp Tables and Execution Plans
Posted by Kevin Eckart at 2/16/2007 12:00:00 AM
I'm having a problem with getting my execution plans to show when there are temp tables involved in the query. I have read that I can execute SET STATISTICS PROFILE ON inside the query and that will allow me to see my plan, but I still cant get it to work. Can anyone shed some light on this ...more >>


DevelopmentNow Blog