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 > may 2006 > threads for thursday may 11

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

Need to monitor database performance
Posted by Amit at 5/11/2006 11:50:01 PM
I need to monitor database performance , how do I do it , can anyone help me....more >>

View or Base Table? Which one is faster?
Posted by Malkesh at 5/11/2006 10:55:01 PM
Hi Friends, In a single query, referening to view is faster or referening to base tabel is faster. Consider I've base table X in which i've column - ColA and i've one view vwX which built upon table X and many more table and that view has also column - ColA which is coming from table X. Now...more >>

DBA vs. Web server admin?
Posted by brett at 5/11/2006 10:43:14 PM
Many DBAs are competely against having any type of web server on the database server box. Web server admins say, "what is the big deal?, We can tighten the web server down so hard, it'll be able to cut glass". In a practical since, let's say your company wants to use SQL Server Reporting Servic...more >>

datetime transformation
Posted by GB at 5/11/2006 8:46:39 PM
Hello, How can I convert datetime value : 2005-10-11 00:00:00.000 to date value: 2005-10-11 ? Thanks, GB ...more >>

How to create scripts (drop then create) in sql 2005
Posted by moondaddy at 5/11/2006 8:33:57 PM
I'm using sql 2005. One thing I could do in sql 2k which I don't see in sql 05 is when I script objects in EM it would check to see if the object exists first, and if so, it would drop it before creating it. I don't see such an option in sql 05 SSMS. Its a much better scripting wizard but s...more >>

Choosing clustered index
Posted by Tom Ellison at 5/11/2006 7:08:33 PM
Dear friends: There is some confusion here about the choice of which index should be clustered. The choices are generally: - the surrogate identity column. - one or more columns that make up the natural key. My contention has been that the latter is the obvious choice. This is the ...more >>

Fastest SQL Server Library
Posted by garyh at 5/11/2006 5:36:29 PM
I need to connect to the Sql Server 2005 on the local machine using C/C++ and am trying to find the fastest way of doing so. I'm dealing with up to a million records and usually lots of small selects. I also can't use joins/stored procedures at this point due to accomodating older software. ...more >>

comma delimited list
Posted by Jay at 5/11/2006 5:15:23 PM
Hello, I have created a small query that will output a list of email addresses that are separated by commas. I plan to copy and paste the list into a email invite field (send to: field for an email app). But what is happening is that only one address appears in the field when I paste because o...more >>



Deleting duplicate entries in nightmare-table
Posted by Lasse Edsvik at 5/11/2006 4:58:52 PM
Hello I was given the task to "filter away" duplicate rows in a 10 million row table with about 30 columns :S And the table has no primary key, no constrains, nothing, and I need to find a way to clear that mess up, in a way... sigh You guys must think, alright, this is easy, just group by,...more >>

automate rebuilding indexes
Posted by Jason at 5/11/2006 4:57:52 PM
Hi, I was wondering if someone had a method to rebuild indexes automatically, based on the results of 'dbcc showcontig'. I want to automate index rebuilding by using the results of 'dbcc showcontig with tableresults' into a table. Then i want to query the results which indexes have a logi...more >>

Sql statemnet Help
Posted by Dominic at 5/11/2006 4:53:26 PM
Hi I'm trying to create a isBooked statement What I have is a db with: Date, StartTime,EndTime I currently run two SQL statements: 1) "SELECT Count(PupilID) FROM TblLessons WHERE " _ & "Date =@GetDate and Time between @GetTime and @GetTimeEnd" 2) Dim StrSqlEndTime As String = "SELECT Cou...more >>

SQL Server 2K5 and VS.NET: Order of Installation
Posted by Jeremy S. at 5/11/2006 3:52:03 PM
I'm about to install VS.NET 2005 and SQL Server 2005 on a new/clean development machine (XP Pro/SP2 etc). Is the order of installation important (i.e., which product should I install first)? Thanks! ...more >>

Requesting Advanced T-SQL help
Posted by Andrew at 5/11/2006 3:41:13 PM
Need some guru help with a monster T-SQL query. Trying to make it more efficient, possibly less code, and anything else I can do to it to make it run faster. This is an SP and Tables created by the person I replaced, but I need to deal with it....for now. I have a Status table that has 50...more >>

SP to test job completion
Posted by TomT at 5/11/2006 3:28:01 PM
The sp below appeared to work fine in SQL 2000, i.e. to start a job, and then return a value on completion. Running this in SQL 2005 appears to just return a value indicating the job has started, but not necessarily completed. I was hoping for some feedback on this, as I don't know any other ...more >>

View dependencies
Posted by news.microsoft.com at 5/11/2006 3:26:26 PM
Hi Folks, I need to get a report of all my views and their dependencies. I know I can check this by right clicking and chosing Delete, then Check Dependencies, but I dont want to use this procedure as its dangerous and I want the whole output in one go. Regards ...more >>

Need to convert a given date to fiscal year
Posted by Paul at 5/11/2006 3:02:15 PM
In a Sql query I need to convert a given date to fiscal year. Fiscal year start from 1-Apr to 31-Mar each year and I need the fiscal year in the format like 2005-06 etc. Thanks ...more >>

Help needed with Instead of Update trigger on a View
Posted by Tore at 5/11/2006 2:30:01 PM
I have an application where we are replacing a subsystem including portions of the database. In order to minimize the code impact on the existing application, we have decided to create a few "compatibility views" - i.e. database Views that produce the same result and with the same names as the ...more >>

How to query a remote server from sql 2005
Posted by Harry at 5/11/2006 2:28:02 PM
Ok,,im stuck. I can access a remote 2000 sql server from sql 2005. I connect directly to the 2000 database ok. I can run queries on it all day. I can do the same thing with another remote ODBC server with SQL2005. THe question is how do you login to SQL2000 from sql 2005 and yet still be ...more >>

Derived Tables and joining to them
Posted by wnfisba at 5/11/2006 2:27:01 PM
I am struggling with some syntax. I have created a couple of derived tables and now want to LEFT OUTER JOIN to them. Can someone help me??? Thanks in advance. Here's the SQL... SELECT DERIVE1A.column_1, DERIVE1A.column_2, DERIVE1A.column_3, DERIVE1A.column_4, DERIVE1A.column_5, ...more >>

Contains
Posted by Alan at 5/11/2006 2:19:01 PM
I have created a full-text catalog in pubs and also include the lname of employee table in the index. However, I got empty result set with the SQL when execute in the Query Analyser : SELECT * FROM employee WHERE contains(lname, 'Perente') ...more >>

Full text index query plans
Posted by ekkis at 5/11/2006 2:18:33 PM
I have a table with a full-text index on a given column. If I run the following: declare @s varchar(100) select @s = 'fast' select * from tblHannahRES where contains(RES_SER_TI, @s) select * from tblHannahRES where contains(RES_SER_TI, 'fast') on my SQL2000/SP4 box I get substantially dif...more >>

Using Java program, calling a SQL to insert a 'null' value - HOW ?
Posted by jvasantharao NO[at]SPAM gmail.com at 5/11/2006 2:06:03 PM
public void mySqlProg { public mySqlProg() {} public String setNullYoTS() { String quot = "\'"; String nullifyMgrTS = "UPDATE REQUEST_TBL SET MGR_APPROVAL_TS="+" "+"WHERE TRANSACTION_GUID = "+quot+tranid+quot;; return nullifyMgrTS; } } when i execute the above statement, ...more >>

Ansi-92 in sql server 2005
Posted by Nuno at 5/11/2006 2:04:01 PM
Is there any flag to enable ansi-92 joins syntax for sql server 2005? -Nuno...more >>

A query to get n values from one column
Posted by VJ at 5/11/2006 1:47:24 PM
I have a query which join 5 tables say my result is Warehouse ProductName Features Price Manf I just need to make some analysis and need to select any 5 features from Features column for each productname. There can be 10 - 50 features mentioned in the table with features. ...more >>

Sql Server 2005 Stored Proc Param used with IN
Posted by lad4bear NO[at]SPAM hotmail.com at 5/11/2006 1:24:08 PM
Hi Guys, In Sql Server 2005 can I send a list of ids as a parameter to Stored Proc and then use it with the IN part of my SELECT statement. I know you can't with 2000 but was hoping that this would have changed with the new version. Cheers, Pete ...more >>

Load assemblies - CLRIntegration
Posted by Grafix at 5/11/2006 1:19:01 PM
All - I have two assemblies (lets say AsmA and AsmB) loaded into SQL Server (Create Assembly) Both these assemblies have EXTERNAL_ACCESS permissions. When the code inside AsmA is executed (within SQLServer context), it tries to load a type in AsmB "dynamically" (using CreateInstanceAndUn...more >>

Move a user database log file
Posted by Yan at 5/11/2006 12:58:49 PM
Hi, SQL 2000 sp3a How do I change the phisical location of the transaction log file? Thanks, Yan ...more >>

SQL Syntax Error in ASP Page.
Posted by TRH at 5/11/2006 12:53:09 PM
Hi, I am a relative novice when it comes to SQL Queries and converting them to ASP pages. I thought that I would be able to cut and paste from the SQL Query Analyzer and get most of the way there. My problem is a syntax error in the From part of the query. The query gives me the desired resul...more >>

AFTER INSERT TRIGGER PLEASE HELP
Posted by steven NO[at]SPAM mindspring.com at 5/11/2006 12:13:36 PM
I need to set up a trigger that updates a field in a record directly after it is inserted. I have been burning some serious cycles on this and can't figure it out. Any help would be apreciated. Here is what I have so far: CREATE TRIGGER DateMod ON tablename AFTER INSERT AS DECLARE @RECO...more >>

Problem removing old back up files....
Posted by CoryK at 5/11/2006 12:00:01 PM
I am having problems with removing the update files from a folder. When a do a new backup, I want it to overwrite the old backup files with the new one. Apparently the code I am using is wrong. Any suggestions??? ...more >>

passing a 'In expression' to Stored procedure
Posted by M at 5/11/2006 11:54:55 AM
Are there a way to pass a expression as a parameter of a stored procedure? I am writing a stored procedure, There is a Select statement something like: Select Name, Street, City, State from CustomerAddress where state in ('MN','CA','TN') Are there a way passing "('MN','CA','TN')" as pa...more >>

Execute a SPROC daily
Posted by Scott at 5/11/2006 10:23:05 AM
What would be the best way to force SQL to fire a SPROC at 6 am each day? I'd appreciate any advice on different and best methods. ...more >>

Fetching duplicate rows uisng IN clause
Posted by mohaaron NO[at]SPAM gmail.com at 5/11/2006 10:18:31 AM
I have two rows in table1 and these two rows are then duplicated in table2 making four rows. I then try and use the following query to select the four rows from table2. select * from Product P where P.ProductVersionID in (select ProductVersionID from PartSet where SetID = ???) Running the ...more >>

Urgent: SQL-DMO Connect method and User Permissions
Posted by russ_h at 5/11/2006 9:51:46 AM
I am trying to determine if a server is available from a trigger in MSDE 2000. We found an example online in which SQL -DMO was embedded in a stored procedure (which I converted to a function) that attempts a connection to the instance in question and then returns success or failure. I have incl...more >>

sql express upgrade
Posted by Jon Paal at 5/11/2006 9:20:32 AM
sql server express won't install latest upgrade.. says it can't login as sa. my sa login has a password but uprade installation nevers asks for it. any suggestions on how to install upgrade ?? ...more >>

Huge table insertion question
Posted by nick at 5/11/2006 9:17:02 AM
I am using the following script to insert a huge table. What's the right value for set rowcount? Should I execute checkpoint in loop? Any better approach? set rowcount 10000 -- wha'ts the right value WHILE @@rowcount > 0 BEGIN -- checkpoint insert into des select .... ...more >>

SMO Install Files
Posted by Amos Soma at 5/11/2006 9:11:43 AM
Does anyone know if Microsoft has released an installation package for SMO? The reason is as follows. In a .NET app we have, we reference SMO files. The server this app is running on does not have SQL 2005 installed, and we don't want to install it just yet. All I want to install are the file...more >>

Orders in last 24 months
Posted by Frenchie418 at 5/11/2006 8:40:02 AM
Hi, I would like to count the number of orders for each month for each one of my customers over the last 24 months. The information will then be used into a Crystal Report Bar Chart. The problem I'm having is that Crystal will only display information that exists. Some of my customers do n...more >>

Need help to do Oracle to SQL Server - SQL conversion
Posted by Mac at 5/11/2006 8:09:02 AM
Hello, I have this Oracle query that does a hierarchical traverse : -- 1. attr_value_list_admin.pl -- Identify collection name of child container SELECT container_name FROM logical_container WHERE parent_id = 1 START WITH container_id = 338058 CONNECT BY PRIOR parent_id = container_...more >>

Hi i have var which has more than 8000 characters
Posted by amjad at 5/11/2006 8:04:02 AM
Hi i heard that in sql server 2005 they introduced MAX to replace text data type like strtemp varchar(MAX)... i have sql server 2005 and i am trying to use it but does seem like working .... i guess the only reason is.... my database server still on sql server 2000 but on client i have sql ser...more >>

Drop tables where name matches a pattern
Posted by lmcphee at 5/11/2006 7:41:02 AM
I have an arbitrary number of tables in a SQL2000 db with names matching 'MyTable_%'. Is there a simple way of dropping these with a SQL command? LMcPhee...more >>

decimal division precision
Posted by kh at 5/11/2006 7:08:01 AM
in my understanding of fixed numeric types and datatype precision rules, dividing two decimals with identical precision/scale should result in a decimal outcome with the same precision/scale. however, i run the following in query analyzer: declare @price decimal(38,10) declare @mult decima...more >>

Finding all "DEFAULT" constraints on a table using Information_Sch
Posted by DoubleBlackDiamond at 5/11/2006 7:06:02 AM
I have a couple stored procedures in which I am trying to determine all of the "Default" constraints that are on a given table. I know that this information is available in the sysobjects table, but I'm trying to avoid directly querying the system tables whenever possible in favor of using th...more >>

urgent about exec function
Posted by amjad at 5/11/2006 6:51:03 AM
is their any way to get result from EXEC function like if i send a query suppos select then i want to check is it return 0 record or more than 0 without using cursor thanks like count=exec @sql ...more >>

hi
Posted by amjad at 5/11/2006 6:49:03 AM
is their any way to get result from EXEC function like if i send a query suppos select then i want to check is it return 0 record or more than 0 without using cursor thanks like count=exec @sql...more >>

Creating crosstab, in Sql r 3GL?
Posted by rvgrahamsevatenein NO[at]SPAM sbcglobal.net at 5/11/2006 6:31:30 AM
I have a program that creates and manages apartment buildings for construction management software. Previously, I had a stored procedure that, when handed a building name with floor count and units per floor integer, created a flat table with 5 columns for each room (one will hold the rooms "nam...more >>

Query over two columns
Posted by Macca at 5/11/2006 6:24:02 AM
Hi, I have a table that includes two Datetime columns. The first column holds the date. e.g 2006/5/10 and the second column holds time e,g 08:15:25. I am having a problems specifing a query that will list the rows in the table between a date time range. i.e return all events between 2...more >>

Need help to calculate time difference between two columns!
Posted by bqirici NO[at]SPAM gmail.com at 5/11/2006 5:57:53 AM
Hi! I need some help to calculate the time difference between two columns, Start_time and End_time. The column values represent the employees' start/end working hours and are stored as varchar(10) in the format hh:mm. Therefore i would like to subtract the start time from the end time to find ou...more >>

mildly complex query. need senior dba advise.
Posted by robert NO[at]SPAM relate.com.au at 5/11/2006 5:23:49 AM
Hi there, I have this stored procedure I am trying to optimize: CREATE PROCEDURE uspLeaderboardStateResults @StateID int AS BEGIN CREATE TABLE #ResultsOutput ( rowID int not null identity(1,1), Rank int, MemberID int, MemberCode varchar(50), State varchar(5), ...more >>

How to run query between two databases
Posted by amjad at 5/11/2006 5:02:02 AM
Hi i have query which i need to join it like i am doing some thing like Select [a].[dbo].[tbla].* From [a].[dbo].[tbla] INNER INNER JOIN [B].[dbo].[tblB ON [a].[dbo].[tbla].[ID] = [b].[dbo].[tbla].[ID] and i am running that query in database A but the only problem ...more >>

Query Syntax
Posted by marcmc at 5/11/2006 4:30:01 AM
I am looking to find records that share the same Policy_Desc but have different Policy_ids. I know there are records that fit this criteria but for some reason this query returns zero rows. SELECT Policy_Desc, Policy_id FROM Policy_Table AS Outside WHERE EXISTS ( SELECT 1 FRO...more >>

latest data for different dates
Posted by Pradeep at 5/11/2006 2:13:54 AM
I have two tables Well status Date,wellid,gas 1/5,A,10 1/5,B,20 2/5,A,11 2/5,B,19 1/5,A,10 2/5,B,21 Well test Date,wellid,gas 20/4,A,10 2/5,A,10 19/4,B,20 the output I want is Date,Wellid,gas,LastweltestDate,GasfromLastwelltest 1/5,A,10, 20/4,10 1/5,B,20, 19/4,20 ...more >>

'Invalid object name'
Posted by Enric at 5/11/2006 1:54:02 AM
Dear all, I've got an issue which to encompass both sql and vb and I can't work out. I'm trying to retrieve data from an ASP page by ADO 2.6 and appears the following error: " Microsoft OLE DB Provider for SQL Server error '80040e37' Invalid object name 'GEN_VentDesp'. /mtotgen/prueba...more >>

nested tree, how to ?
Posted by andrew at 5/11/2006 1:50:48 AM
hi, i've problems representing nested tree in sql server strucutre ... my scenario is : several process (p1,p2,p3,etc..) makes several operations (op1,op2,op3,...) i need to store the combination process,operation,time and this ismy table structure (processid,opid,dateop) now i need to show a...more >>

ROW_NUMBER is very slow on large tables
Posted by Anton Bar at 5/11/2006 1:13:02 AM
Hi all, I thought that ROW_NUMBER is designed to handle paging on large tables. However, when I test it on a table with 1,000,000 records, a simple select with ROW_NUMBER hangs for more than 10 minutes. Any idea what can be done? My table is: Events (ID, Date, Desc) My query is: ...more >>

SQL DIAG Error
Posted by ina at 5/11/2006 12:22:39 AM
Good morning all, I would like to use the sqldiag in order to diagnostic SQL server, so I am doing that in SQL query: xp_cmdshell '"C:\Program Files\Microsoft SQL Server\MSSQL$MICROSOFTBCM\Binn\sqldiag.exe"' and I have this errors: 'C:\Program' is not recognized as an internal or exter...more >>

SQL25k Critical, issue with datatypes
Posted by Enric at 5/11/2006 12:04:01 AM
Dear all, I’ve made a SSIS package which take a sql statement and carry on to the .xls file but when I launch that package appears these errors: Error at Data Flow Task [Excel Destination [31]]: Column "descripcion" cannot convert between unicode and non-unicode string data types. (Mic...more >>


DevelopmentNow Blog