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 > july 2007 > threads for monday july 30

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

function exists
Posted by Bpk. Adi Wira Kusuma at 7/30/2007 11:45:31 PM
statement 1: EXISTS (SELECT * FROM publishers WHERE pub_id = titles.pub_id AND city LIKE 'B%') statement 2: EXISTS (SELECT City FROM publishers WHERE pub_id = titles.pub_id AND city LIKE 'B%') Do both statements have the same best performance? Or Statemen...more >>

Hex to Int Conversion
Posted by shiju at 7/30/2007 11:26:21 PM
Is there any way to convert a Hex passed as varchar Below works select cast(0xAD as int) But not this declare @name varchar(10) select @name= '0xAD' select cast(@name as int) --Gives a conversion error. Thanks Shiju Samuel ...more >>

CREATE composite index error
Posted by Curious at 7/30/2007 7:33:43 PM
I try to create an index that references three columns in a table: --------------------------------------------------------------------------------------- CREATE UNIQUE NONCLUSTERED INDEX [AK_DataReadyStateCache_Unique] ON [dbo].[DataReadyStateCache] ( [DataReadyStateTypeID] ASC, [Questi...more >>

searching for one field within another
Posted by Rahul Chatterjee at 7/30/2007 6:46:44 PM
I am joining 2 tables using a bunch of criteria - I also want to check for the existence of data from one field in one table to another field in the other table e.g I have "streetaddress" in one table "Barton", the other table has "address" field "1020 BARTON RD". I want to match if stre...more >>

How to get yesterday's date in a query
Posted by Michael at 7/30/2007 6:42:24 PM
Hi, I am using MS SQL2000. I tried to use the query to do the following. Why does it not work out? I could not get DateAdd("d",-1,Today) work correctly. select distinct a, count(*) from test where [timestamp] > DateAdd("d",-1,Today) group by a Thanks a lot for your help!! Michael ...more >>

Finding the next sequential number in a series
Posted by Kirk at 7/30/2007 6:10:08 PM
Hello, I have a table where one field is a part number. These part numbers consist of a "base" number, then a dash ("-") and then a dash number. Examples: 300-102, 1534-32, 98872-12345. I would like to create a SP where I pass it a base number and it returns the next sequentially available...more >>

how to change database context
Posted by Helmut Woess at 7/30/2007 5:02:36 PM
Hi, changing the database per name is no problem USE master GO .... and everything is okay. But i need this in a script and have the database name in a variable. How to make this? select @cmd = N'use ' + @oldDb + N';GO' exec sp_executesql @cmd doesn't work. Is something possible a...more >>

Conditionally select fields
Posted by Robert Hancox at 7/30/2007 4:49:24 PM
I'm trying to create a mailing list using a query. Simple enough. I have two tables. One is 'Practices' (doctor's offices), a parent table, and the other, 'Members', is a child table that has all the people who work for these practices. There is address information in both tables. If an ind...more >>



Custom Report Delivery Extension not showing up as an option in the Subscriptions screen.
Posted by Rico at 7/30/2007 3:55:44 PM
Hello, I've implemented the sample Printer Report Delivery extension in my installation of SSRS (SQL Server 2000). However, for some reason the Printer option doesn't show up in the combo box of the Report Delivery Options. Any ideas what I should look for? According to the tutorial, all...more >>

Help! Having trouble Imlementing Report Services printer delivery extension sample
Posted by Rico at 7/30/2007 3:40:33 PM
Hi All, I've been trying to implement the sample Report Services Printer Delivery extension. I've been through the tutorial and haven't been able to add the following security code group (shown at the bottom) successfully, since there is no indication of where this should go or why. I not...more >>

variable where clause
Posted by rodchar at 7/30/2007 3:02:02 PM
hey all, select * from categories where categoryid = 1 or categoryid = 2 what's the best way to create a stored procedure that would accept a variable amount of categories for the where clause? for example if i just wanted to search for categoryid = 1 instead of both 1 and 2. thank...more >>

Sql Help
Posted by Arul at 7/30/2007 2:18:06 PM
I'm using Sql Server 2005. I have a table with two columns; PropertyName and PropertyValue. PropertyName has values like LastName, FirstName, Title and PropertyValue has the valus for those PropertyNames. Ex: AccountName Doe FirstName John LastName Doe Manager Jane Smith AccountName Cram...more >>

cannot attach db
Posted by Keith G Hicks at 7/30/2007 1:52:03 PM
I had a development system crash (OS HDD failed) and had to reload things recently. My data drive and backups of that were intact. I reinstalled SQL 2k and tried to reattach the mdf files. Here's what I did in QA: EXEC sp_attach_single_file_db @dbname = N'Caser', @physname = N'D:\Data\MSSQL\Da...more >>

how can iwe identify tht the page is post back?
Posted by harry at 7/30/2007 1:31:07 PM
how can iwe identify tht the page is post back? ...more >>

Replace the LAST ',' with '='
Posted by Curious at 7/30/2007 1:30:13 PM
I have a string type of column called 'Question' in a table, DataReadyStateCache. Each record for this column contains 7 commas (',') in the middle of the string. Each record for this column is in the format of: substring1,substring2,substring3,substring4,substring5,substring6,substring= =AD ...more >>

can i use "order by clause"in a sub querry
Posted by harry at 7/30/2007 1:23:54 PM
i have to find 7 th highest salary in a table. i use order byb clause in a sub quarry? is it work? ...more >>

DDL trigger with rollback
Posted by Sammy at 7/30/2007 1:22:11 PM
Hi the BOL DDL trigger below is it possible to add rollback to it and still see changes that people have made to the database schema. I have tried with the rollback and nothing is entered onto the ddl_log table. I would like to capture all events even if rolled back is this possible. thank...more >>

Querry
Posted by harry at 7/30/2007 1:20:18 PM
I have a table of 10,000 rows .i have to made 1 cluster index and some non cluster index in that table.what i should make first i.e. made cluster index first or make non cluster index? ...more >>

Replace the LAST ',' with '='
Posted by Curious at 7/30/2007 1:06:45 PM
I have whole bunch of rows in a table that contain 7 commas (',') as a separator. Each row is in the form of: substring1,substring2,substring3,substring4,substring5,substring6,substring7,substring8 I'll need to replace the LAST ',' with a '=' for each row of data. What's the most efficient S...more >>

When does SQL 2000 become officially 'unsupported'?
Posted by Mike Whiting at 7/30/2007 12:46:01 PM
Does anyone know if Microsofts' obsolesence policy still holds? That is, when a product is 2 versions behind, it is no longer supported with SP's and hotfixes? So, when SQL 2008 comes out, will SQL 2000 still be supported? I'd certainly expect that PSS would still take call on it, but most of...more >>

full backup no login
Posted by rodchar at 7/30/2007 12:42:02 PM
hey all, i'm doing a full backup from SQL Management studio and when i go to restore that database on a different server my user-defined login doesn't show up. I have to delete the old login which shows up in the database users and then recreate the user in Logins and remap to database. ...more >>

Calculating Averages
Posted by Anonymous at 7/30/2007 12:18:08 PM
SQL Server 2000 I have a simple select statement to calculate the average: SELECT avg(duration) FROM tablename The problem is the average is being rounded incorrectly. For example, if I am calculating the average of 718, 721, 1032 the avg is 823.6. However, the avg is coming out to 8...more >>

Export SQL data into Excel on a remote server
Posted by Goran Djuranovic at 7/30/2007 12:15:49 PM
Hi all, I am unable to export a small table (50 rows) into an excel on a remote = machine (called MyPC in this case). I run the following code in a Query = Analyzer: SELECT * FROM OpenRowSet('Microsoft.Jet.OLEDB.4.0', 'Excel = 8.0;Database=3D\\MyPC\testshare\testing_new.xls;', 'Select * From ...more >>

Help with query ...
Posted by Jamie Risk at 7/30/2007 12:08:33 PM
How can I create a query for the following that will return results for say; * 'Phoned' and not 'Ordered' -> ('Harry') * 'Phoned' and not 'Invoiced' -> ('Dick' & 'Harry') - Jamie CREATE DATABASE [test_db] GO use [test_db] GO CREATE TABLE [dbo].[Customer] ( [id_Custom...more >>

Error, "Invalid length parameter passed to the substring function"
Posted by Curious at 7/30/2007 11:31:36 AM
When running this huge select statement, I got an error: "Invalid length parameter passed to the substring function" The statement is as below: --------------------------------------------------------------------------------------------------------------- SELECT DataReadyStateCacheID, ...more >>

How do we create compound foreign key?
Posted by beginner16 at 7/30/2007 11:17:34 AM
hello I use MS SQL server 1) Example of a table with compound primary key would be: CREATE TABLE A ( b integer, c char(5), d integer, PRIMARY KEY ( b, c ) ); But how do we create compound for...more >>

XML datatype parsing error.
Posted by Arne Garvander at 7/30/2007 9:52:04 AM
I am trying to update a column that has the XML datatype. I get this error XML parsing: line 4, character 16, unexpected end of input when executing the sql below. What am i doing wrong? declare @temp nvarchar(100) set @temp =N'<books> <book name="Golf for dummies" /> <book name="Footba...more >>

data conversion problem - arithematic overflow
Posted by sbcaco at 7/30/2007 9:14:00 AM
hello, I have the following problem: data info: Table1.Volume2 is a char(11) field (data looks like 50, 2, 3, 0.05, 0.12) Lookup1.Volume is a char(11) field (data looks like: 00000162000, 22000000000, 02400000000) The value of Lookup1.Volume is usually divided by 1000 and should look...more >>

SQL Sever Profiler
Posted by Curious at 7/30/2007 9:13:05 AM
I'm using SQL Sever Profiler to trace the stored procedures being exected on the server. I want to filter out the stored procedures that are frenquently executed yet not related to the issue. What's the exact syntax for setting filters in "Not like"? There's "Edit Filter" dialog. I select "Tex...more >>

Increase join performance
Posted by Stephane at 7/30/2007 8:56:03 AM
Hi, I'm trying to join two tables. The table user and the table logs. A user can have millions of logs. When I try to join a user and its logs, the join is really slow. I suspect the problem is that the logs table return 4 millions of rows. I can't really diminish that number and it's th...more >>

Bug in "OSQL.exe" utility
Posted by Curious at 7/30/2007 7:41:35 AM
I'm studying the fix to a bug about "OSQL.exe" utility. It's BUG #: 471423 - The Osql.exe utility does not run a Transact-SQL script completely if you start the program from a remote session by using a background service and then log off the console session What happened was that I ran a sche...more >>

Updated row ID in a TRIGGER
Posted by cubilon at 7/30/2007 6:57:16 AM
Hi all, I've a problem and I'm unable to solve it. I wrote a trigger like that: ALTER TRIGGER reminder ON USERS AFTER UPDATE AS IF (UPDATE(PASSWORD)) BEGIN UPDATE LOGS SET LOGS.DESCRIPTION = 'Password changed' WHERE LOGS.IDUSER = ??? END; GO I don't understand where to take ...more >>

how to get file,file group list for a database?
Posted by prince at 7/30/2007 6:56:02 AM
Hi, Can any body tel me how to get list of files and file groups available in a database thro sql query? thanks in advance. Prince ...more >>

Error: "A RETURN statement with a return value cannot be used in this context."
Posted by Curious at 7/30/2007 6:39:38 AM
I have the following script: ------------------------------------------------------------------------------------------------------- DECLARE @liError int -- Add three new columns ALTER TABLE SystemParameter ADD Threshold int, -- Could be either number for count threshold or minutes C...more >>

Calculating a yield rate...
Posted by Mangler at 7/30/2007 6:11:30 AM
I think I'm on the right track here but cant get it all the way. Maybe someone can point me in the right direction from what i have started. First here are the tables: CREATE TABLE [dbo].[bt] ( [idtrans] [int] IDENTITY (1, 1) NOT NULL , [idrma] [int] NOT NULL , [phmodel] [nvarchar] (30) ...more >>

Any idea's why these two queries take such a different amount to return?
Posted by ianwr at 7/30/2007 5:52:00 AM
Hi, I was wondering if anyway could throw any suggestions on the following and why one query was taking so much longer than the other. The queries come from a data warehouse where the fact table is 230million rows. It joins onto a time dimension but then also onto a BOW_DATE_RANGE_V view whic...more >>

Novice: Column seed value?
Posted by Peter at 7/30/2007 5:34:03 AM
Hello, Thanks for reviewing my question. I would like to know how I can write a query where one column increases in value as query is displayed. (Like a row number) NAME ID John 1 Bill 2 Frank 3 I tried using ROW_NUMBER() but it only display one each time. ...more >>

Performance query help
Posted by NightDreamer at 7/30/2007 4:36:00 AM
Hi I've a stored procedure in dynamic sql, that produces some sql query, that works well, and produces de right results, but now since the the interval of Id's grow up, had poor performance and causes the system slow, to other queries. It's a sql server 2005 Enterprise Edition. This is th...more >>

Want to find Non-English characters in SQL Server 2005 database
Posted by Farhan Iqbal at 7/30/2007 3:46:04 AM
hi, Is there any function available in SQL Server 2005 to determine the Non-English characters in data fields? I have lots of data in my tables and I want to change some of my data types from nvarchar to varchar, that’s why I want to know if the Non-English characters are exists in data fil...more >>

Left Join Question
Posted by hon123456 at 7/30/2007 1:41:25 AM
Dear all, I have two table call Invoice and Shipper just as follows Table Invoice ID Field-ABC 1 A 2 B Table Shipper ID ...more >>

Help on Update Query
Posted by Bassam at 7/30/2007 12:00:00 AM
Hello, can anyone pls help on this update, i can't figure it out! I have 3 tables TableA InvoiceID - Identity FileID - INT OpNo - INT TableB PKey - Identity InvoiceID - FKey to TableA InvoiceID ItemID - INT TValue - Decimal TableC PKey - INT Identity FileID - INT OpNo - INT It...more >>

Database optimization using indexes
Posted by QDL at 7/30/2007 12:00:00 AM
Hello everyone, we have a large application (aspnet and dotnet) which uses a quite complex database (109 tables). I have been asked to optimize query times that (on some tables which can grow quite big) is becoming slower and slower... At the moment we only have primary keys on autogene...more >>

Optimizing table with more than 54 million records
Posted by Gaspar at 7/30/2007 12:00:00 AM
I have a table that has more than 54 million records and I'm searching records using the LIKE statement. I looking for ways to optimize/partition/etc. this table. This is the table structure: TABLE "SEARCHCACHE" Fields: - searchType int - searchField int - value varchar(500) - externa...more >>

OPenxml inserts and Null values
Posted by Swagener at 7/30/2007 12:00:00 AM
Morning, I am using this stored procedure to recieve a xml doc as parameter and then shredding it to insert records, all works well apart from the AGENTID as it keeps writing NULL values in the table. Been trying to find errror in my syntax for while but with no luck. I hope you guys can help. ...more >>

string replace
Posted by Agnes at 7/30/2007 12:00:00 AM
In stored procedure, i want to replace serveral character in the string. E.lg ="HKG-123333", REPLACE TO "LAX-12333" i don't want to use left(), any other function can use? Thanks a lot ...more >>

query
Posted by someone NO[at]SPAM js.com at 7/30/2007 12:00:00 AM
I posted this before, but couldn’t find it. Here is the question: Use Northwind, how to query out: Employee.EmployeeID, Employee.LastName, Employee.FirstName, Max(Orders.OrderDate), Orders.ShipName -> Correspond to Max(OrderDate) entry Thanks... ...more >>

Query help
Posted by someone NO[at]SPAM js.com at 7/30/2007 12:00:00 AM
Hi, I posted this before, but couldn’t find it. Here is the question: Use Northwind, how to query out: Employee.EmployeeID, Employee.LastName, Employee.FirstName, Max(Orders.OrderDate), Orders.ShipName -> Correspond to Max(OrderDate) entry Thanks... ...more >>


DevelopmentNow Blog