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 > october 2006 > threads for thursday october 5

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

Poor Execution Plan in SQL Server 2005
Posted by Leila at 10/5/2006 10:58:01 PM
Hi, We have a database in SQL Server 2000. I made a copy of this database(mdf,ndf,ldf) and attached it to SQL Server 2005 on the same machine. When I try one particular SP in both of them, SQL Server 2000 performs almost 2.5 times faster than 2005. The execution plan in 2005 contains HASH p...more >>


Return as single row from multiple rows in a column
Posted by obelix via SQLMonster.com at 10/5/2006 8:40:21 PM
I probably didnt make sense the first time around so I'll try again. I'm selecting one field from a tbl but with a result set of more than one row and I want to bring back all the rows in a single string. -- obelix "Whether you think you can or you think you cant you are right" .... Anon ...more >>

Return as single row from multiple rows in a column
Posted by obelix via SQLMonster.com at 10/5/2006 8:34:20 PM
I'm reading one value in a select but I want to return it as a string in a single row.Please help -- obelix "Whether you think you can or you think you cant you are right" .... Anon Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/20061...more >>

osql with shellexecute problem
Posted by Keith G Hicks at 10/5/2006 7:10:22 PM
According to the results of ShellExecute, it seems that I can have a successful OSQL run that wasn't really successful. For example, if I perform a "Restore database" using OSQL and the restore could not get an exclusive lock on the db, ShellExecute returns a successful result but the message fr...more >>

Totals Help
Posted by Paul Ilacqua at 10/5/2006 6:53:03 PM
Based on this query..... how can I total just the starred SYS_OP's produced column Compute by will sum them all. I want daily totals of just the starred operations but still list them all. DECLARE @sDate SmallDateTime DECLARE @sEnd SmallDateTime DECLARE @sPart Char(15) SET @sDate = '2006...more >>

Management Studio changing view syntax
Posted by Chris Botha at 10/5/2006 5:40:41 PM
Is this an issue or should I just leave it? I use Management Studio in 2005 to create a view. If I type in my SQL, it changes the SQL and the syntax is a heck of a lot longer and I don't know if it screws up the efficiency of the view too. Here is an example: Where (AAA = 0) And (BBB = 1 ...more >>

A single statment.
Posted by PBSoft at 10/5/2006 5:37:13 PM
If I execute the folowing statment against the table that I have in my database... SELECT Customers.Name, Customers.Active FROM Customers ....the result will be: Name (varchar) Active (bit) Customer1 1 Customer2 0 Customer3 ...more >>

is there a similar COALESCE function for smallint
Posted by Abraham Andres Luna at 10/5/2006 4:52:38 PM
hello everyone, i started using the coalesce function to return empty strings instead of the keyword null if a column contains a null value however, this function breaks if the column data type is smallint (or any number type i think) example data: STKNU|ENGHP AAAAA|NULL BBBBB|300 i...more >>



Question on making a listing from 2 tables
Posted by Blasting Cap at 10/5/2006 4:50:05 PM
I've gotten a request from a user to create a report I'm not sure I know how to create. There are two tables, one a product table, the other a customer table. The request is to give a listing per customer of products they have NOT bought. i.e. to identify possible sales opportunities in a...more >>

Where to find Giant SQL Server 2000 System Table Diagram?
Posted by Ryan at 10/5/2006 4:25:02 PM
Hi, I used to have a giant SQL Server 2000 poster that was a diagram of all the system tables, but in my most recent move it has disappeared. While I still have my 2005 system views diagram poster (from the Rock the launch event), I would like to get one of the 2000 tables to post on my wa...more >>

View whether a trigger is enabled or disabled
Posted by Christian Perthen at 10/5/2006 3:23:44 PM
Hi, I am using this query to list all my trigger that are used but is there a way to tell if they are enabled or not? SELECT name, crdate, refdate, stats_schema_ver, type, schema_ver, parent_obj, base_schema_ver, status, info FROM sysobjects WHERE (type = 'TR') ORDER BY...more >>

Multiple CASE & SET statements
Posted by MeganMac at 10/5/2006 1:46:02 PM
I'm new to SQL and I can't seem to figure out how to do this. I have multiple SET and CASE statements that I want to process. They work if I run them one at a time but it doesn't work if I run the entire sequence. I'm not sure if it's because I refer to previously created fields later in the s...more >>

Problem with ampersands "&"
Posted by Rob Epler at 10/5/2006 1:39:01 PM
I’m using XQUERY to slog through an XML doc, and dump the value of a CDATA element into an NVARCHAR(MAX) field. The problem I’m running into is that when an ampersand goes into that field, what I get back out in a query (using FOR XML) is “&”. using: CONVERT( nvarchar(MAX), T.c...more >>

SQL2005 & vb.net 2003
Posted by Peter Newman at 10/5/2006 1:13:01 PM
im running a vb.net 2003 application and it is using a data adapter to sql2005. The data adapter has an Inser command which is as follows SELECT Licence, LicenceIndex, IsMaster, Title, ForeName, SurName, Position, DayTelephone, DayExt, EmergancyNumber, MobileNumber, Facismile, ...more >>

Comparing string data to a text field
Posted by Steve Harp at 10/5/2006 1:11:17 PM
Hi All, I'm writing a stored procedure to insert data into a table that has a text field (SQL 2000). I'd like to compare the input data prior to making the insert so that I don't get duplicates of the text data in the table. How can I do this? The server won't let me do a select ... where...more >>

any easy ways to pick up SSIS ?
Posted by SQL Ken at 10/5/2006 12:57:56 PM
I've spent a couple days going over online book on SSIS. It looks too complicated. Is this just me or others feel the same way? is there any good book or tutorial out there? Thanks Ken ...more >>

How to do nothing
Posted by Phuff at 10/5/2006 12:56:48 PM
How do I do nothing? I have a statement that only formats correctly in one format and I have an if else. Right now I do a PRINT '' but that seems hoaky...any suggestions? DECLARE @flg int SELECT @flg = id FROM jobStatusFlags WHERE quoteNumber='{0}' AND unit = {1} IF @flg > 0 PRINT '...more >>

complex INSERT
Posted by spitapps at 10/5/2006 12:46:34 PM
Here is the situation: I have a table with a latitude and a longitude column, this table has like 5000 rows. So in my web app, I get a latitude and longitude coordinate, and a range from the user. I need to compute the distance between the 2 points(user lat/long and every lat/long in the table...more >>

multiple tables...
Posted by CipherTeKST at 10/5/2006 11:55:02 AM
I have a table with a list of names (example: Aaron, Ben, Chris, David, etc.) and a second table in a different database with a list of names and id's (example: Aaron, 1) some of the names from the first table are not in the second table because they do not have an id number yet. My problem i...more >>

SS 2005 - table column fields
Posted by SAM at 10/5/2006 11:37:01 AM
Is there a way to go through the user defined tables and re-organized the colum names of each table? I want all guid fields to be at the top and then sort the rest of the columns of each table. ...more >>

SP to read data from another machine
Posted by Darin at 10/5/2006 11:34:30 AM
I need to create a stored procedure similar to the following: create procedure dbo.pSync ( @in_db char (20), @in_server char (50) ) AS INSERT INTO Table1 (tab_col1, tab_col2) SELECT tab_col1, tab_col2 FROM @in_server.@in_db.dbo.ARCustomer WHERE ccst_salesman=@in_salesman But, it see...more >>

SS2K service pack 4
Posted by PJ6 at 10/5/2006 11:25:07 AM
Can I directly apply SP4 to a fresh installation of SS2K off the CD, or do I have to download and install all the previous service packs first? Paul ...more >>

CASE Statement and > Problem
Posted by Brennan at 10/5/2006 11:20:01 AM
Hi All: I am getting an error with this line of code: Case dbo.hbs_pohd.variance_dollars_ When Sum(dbo.hbs_pohd.invoice_dollars_- dbo.hbs_pohd.total_budget_ - dbo.hbs_pohd.variance_dollars_)> 0 Then Sum(dbo.hbs_pohd.invoice_dollars_ - dbo.hbs_pohd.total_budget_ - dbo.hbs_pohd.variance_dol...more >>

why is case statement returning null
Posted by Abraham Andres Luna at 10/5/2006 11:14:28 AM
hello everyone, i need help with a query i designed. i'm not sure why the description = column shows up as null for stknu 1300. SELECT I1.STKNU AS [Unique ID], I1.MODMK AS Make, I1.MODEL AS Model, = I1.MODYR AS Year , (CASE I2.AMTPR WHEN .00 THEN 'Call For Price' ELSE CAST(I2.AMTPR AS = V...more >>

SQL 2000 - Connection Error with DTS Packages
Posted by Andrew at 10/5/2006 9:46:37 AM
Up until last night, everything with our production SQL Server was running just fine, but a few jobs failed and now I have a problem I can't figure out.... Actually, there were three things that went South last night.... don't know if any of them relate to my problem, but I'll just state th...more >>

Is this possible? Where in (wildcard)
Posted by davidr NO[at]SPAM sharpesoft.com at 10/5/2006 9:09:14 AM
There is process that dynamically buids a list to include in the where clause so select * from blah where ID in ('afa','asd','afafsds') but at times we would like to just put in a wild card into the in clause. So is this possible? Select * from blah where id in (%) kind of like select *...more >>

Log BUs
Posted by CLM at 10/5/2006 9:04:02 AM
Is there any problem(s) with doing log backups on the system tables on SS 2000? Is this a "best practices" thing?...more >>

sql statement - distributed query, same schema, two tables, identical & unique data?
Posted by jpbisguier NO[at]SPAM yahoo.ca at 10/5/2006 8:48:36 AM
need an sql statement that will get generate a single record for each duplicate data and also for unique records that might be in either table A or table B left outer join? ...more >>

Results of a SQL query into a text file in VB
Posted by Kelil at 10/5/2006 8:32:02 AM
How do I export the results of the query into a text file using Visual Basic. i have looked at several groups for the result, with no luck My current code:- Option Explicit Private CnSql As New ADODB.Connection Private RsSql As ADODB.Recordset Public Function CnSql.Open "PROVIDER=MSD...more >>

compare dates without timestamp
Posted by Chris at 10/5/2006 8:12:02 AM
Hi, I need to compare 2 dates to see if they are equal but without the time stamp. where process_date = currentdate (both without time: hh:mm:ss) Surprisingly this search has led me to investigate julian dates, casting, converting, datediff, dateadd and and everything in between. How hard...more >>

How to run a DTS Package saved in SQL Server?
Posted by Shocky at 10/5/2006 7:50:23 AM
I'm new to DTS. How do i run a DTS Package saved in SQL Server? ...more >>

Inserting a row into the same table?
Posted by DotNetDev at 10/5/2006 6:48:02 AM
Hi, I want to copy a row into the same table. I tried INSERT INTO PRODUCTS SELECT * FROM PRODUCTS WHERE ProductId=2 ProductId is an identity column in Products table. But the above statement doesn't work. How can I make a copy of a row in the same table and I want to do this in on...more >>

Query Problem
Posted by FARRUKH at 10/5/2006 6:36:02 AM
This query list all the user tables in the database along with their sizes: I am trying to put COMPUTE clause so i can get the total database size. i am getting an error. anybody knows where should I put COMPUTE claus -----------------------------------------------------------------------------...more >>

IBinarySerialize, Read method, and BinaryReader
Posted by Andy in S. Jersey at 10/5/2006 6:33:02 AM
This is a continuation of sorts of the thread: UDF that take a UDT as a parameter (CLR) Thanks again Kent I have my interval type (UDT) and have created a number of UDFs that use it. I can see the new type in SS2k5 and am able to create tables that use the type in a column. The UDT is...more >>

cast int to decimal to varchar
Posted by cowznofsky at 10/5/2006 5:31:03 AM
I need to take an int representing minutes and convert it to hours, with one decimal place, and put it in a varchar(5). So the code below works, but I'd be interested if there was a more concise way to do it. declare @minutes int select @minutes = 121 select cast((cast((cast(@minutes as de...more >>

Sql code for reorganizing data and indexes
Posted by Svein Erik at 10/5/2006 4:49:02 AM
1. Can someone help me with the code for reorganizing the data and indexes? 2. And also the code for checking the database integrity and attempt to repair minor errors? Thank you! Svein Erik...more >>

Simple sql question
Posted by mullin at 10/5/2006 3:54:33 AM
There're two tables, Result, Account Result ====== Account_ID Quantity Reason 1111 123 2222 32 3333 442 4444 567 Account ======= Account_ID Account_Name 2222 xxxx 3333 yyyy I want to write a single update statement t...more >>

Prolem with nulls
Posted by pier73_2005 NO[at]SPAM hotmail.it at 10/5/2006 3:35:18 AM
Hi all, I got some bug reports on search queries in my enterprise application based on Sql Server 2000. After a session of bug hunting I found a strange behaviour using isnull and null varchar. Steps to recreate the problem: 1) Create a table named "Table1" if exists (select * from dbo....more >>

Unique identifier in temporary table
Posted by AdamHCC at 10/5/2006 2:05:05 AM
Hi, I'm using a temporary table in my T-SQL code and I would like to include a unique identifier, i.e. automatically increase for each row in the table. Is there a simple way to achieve this? Adam ...more >>

Column X is invalid in the select list ...not contained in either an aggregate function or the GROUP BY clause
Posted by Janet at 10/5/2006 12:01:12 AM
I'm having a problem with a select query. I want to return a GrandTotal value grouped by name, but the query analyzer throws an error: Column 'ct.Total' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. If I add th...more >>


DevelopmentNow Blog