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 friday july 27

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

Selecting Max Len of all columns
Posted by naomi_williams via SQLMonster.com at 7/27/2007 8:22:27 PM
The basic script I am running is Select Max(Len(*)) I want to view all of the max column lengths. The error I get is Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '*'. What am I doing wrong? -- Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-serv...more >>


ltrim(rtrim(<column>)) not working
Posted by david at 7/27/2007 8:16:19 PM
I have a user trying to use the following code and he is getting duplicate rows back. I don't think he should but can't explain why it is not workig. has anyone else seen this before? SELECT DISTINCT LTRIM(RTRIM(<column name>)) FROM <table value function> He is getting 8 rows back one of ...more >>

Problem with recursive call of trigger.
Posted by info NO[at]SPAM pstruh.cz at 7/27/2007 6:32:58 PM
Hi. I have a problem with UPDATE trigger and SQL 2005, when trigger calls update of the table. The sample environment, table 'test' with trigger: create table webdata..test(col int, help int) go insert into webdata..test values (1,1) go CREATE TRIGGER [ud_test] ON webdata..test AFTER ...more >>

Select distinct pairs
Posted by WallyDD at 7/27/2007 6:12:51 PM
Hi, I am trying to select some distinct pairs from a table. The table looks something like this; Username, partner Bill, Ted Ted, Bill Fred, Barney Barney, Fred Mike, John and I would like the output to be like Bill, Ted Fred, Barney Mike, John I have tried SELECT DISTINCT an...more >>

Need a query...
Posted by GB at 7/27/2007 4:07:36 PM
Hello, I have the following table: F1 F2 VALUE -------------- AA K1 5 DD K1 4 FF K1 3 GG K1 2 DD K2 3 SS K2 2 ZZ K2 1 I need a query to get the following result set: F1 | F2 | VALUE | ROW_COUNT ---------------------------- AA K1 5 1 DD K1 ...more >>

How to test a NULL column type
Posted by light_wt at 7/27/2007 4:02:01 PM
Hi, I've several tables, in hundreds, with columns not allowing NULL. Is there a good way to test the column and see if it is defined to allow NULL or NOT then execute ALTER TABLE dbo.mytab ALTER COLUMN c1 INT NULL; Thanks. ...more >>

How to INSERT INTO a temp table
Posted by mitra at 7/27/2007 3:44:01 PM
Hi All, First, I need to convert the data that's in sql datetime format to unix timestamp format * 1000 then INSERT the unix timestamp values INTO a temp table for later use. After sometime searching, I found how to convert the sql datetime to unix timestamp but having trouble using i...more >>

Messages in output window don't seem right
Posted by Curious at 7/27/2007 2:15:22 PM
I use a cursor that loops through each row in a dataset (rows in a table that meet certain criteria). It seems that it's a dead loop since it takes forever to run for such a small dataset. Therefore, I've added a few PRINT statements to see what is happening. FYI, below is the part of the s...more >>



Reset Identity seed
Posted by Bill Nguyen at 7/27/2007 12:59:10 PM
Is it possible to delete all records in a table with Identity and reset Identity seed to 1? Currently I have to drop a table and recreate every time I want to reset the Identity. Thanks for your help! Bill ...more >>

Problem on data importing and trigger
Posted by AliRezaGoogle at 7/27/2007 12:31:33 PM
Hi all, I have a table named Table1. It hase a primary key named TID with bigint type. Table1 has an INSTEAD OF INSERT trigger. This trigger computes maximum TID on current data in the table then increase it by one to compute TID for new row which is going to be inserted. One may assume this ...more >>

Stored procedure to insert data ...
Posted by Jamie Risk at 7/27/2007 12:31:11 PM
I'd like to create a stored procedure that adds an empty row to the table following, and return the ID of the newly added row (or the entire newly added row). How can I do this? -- Table schema CREATE TABLE [dbo].[Patient] ( [id_Patient] [int] PRIMARY KEY IDENTITY(1,1) NOT NULL, ...more >>

SELECT multiple LIKE clauses and return how many columns match
Posted by Brad Brening at 7/27/2007 11:43:40 AM
Thanks to Hugo Kornelis, (blog: http://sqlblog.com/blogs/hugo_kornelis) I've made major progress toward creating a query that will take multiple LIKE clauses and return the records that match along with a custom column describing how many matches those columns contain. For example, I have a ta...more >>

Help - why does SqlException not list Procedure name on timeout?
Posted by at 7/27/2007 8:31:07 AM
When I have a timeout on invoking a stored procedure against SQL Server, I have an exception returned that looks like the following: {System.Data.SqlClient.SqlException} System.SystemException: {"Timeout expired. The timeout period elapsed prior to completion of the operation or the serve...more >>

osql mode
Posted by rodchar at 7/27/2007 7:58:07 AM
hey all, when i'm working in osql from the command line is there a way to clear the screen. i know cls in dos but is there one in osql "query mode" (i.e. 1>clear screen) thanks, rodchar...more >>

SQL 2005 Partition Table
Posted by Nitin at 7/27/2007 7:10:03 AM
I have SQL 2005 environment and I have set up Partition Table on it. I switch out existing partitions from it by moving the partition to blank table which works really well. However, when I try to move in a loaded table into an empty partition, I am getting following error which doesnt make an...more >>

backup an instance
Posted by rodchar at 7/27/2007 6:32:01 AM
hey all, i'm looking in sql books online at the backup database command and saw the following example: -- Back up the full AdventureWorks database. BACKUP DATABASE AdventureWorks TO AdvWorksData how do you tell it which instance of sql you would like to use? thanks, rodchar...more >>

Create function with missing dependency works in SSMS and sqlcmd but not using ADO
Posted by bendlam at 7/27/2007 6:07:00 AM
I'm trying to build a database using scripts on a local drive. I'm doing this as part of an MSBUILD project. The MSBUILD uses a special task to execute ddl statements using a ExecuteNonQuery. When I try and create a function with a missing dependency it throws an exception : Cannot find ei...more >>

Sql server error codes
Posted by Mojo45 at 7/27/2007 5:34:01 AM
Hi, Can someone tell me where I can find a list with all the error codes and there meaning. TIA ...more >>

TempDB maintenence
Posted by Bala at 7/27/2007 4:58:03 AM
Hi, Our DB is abt 200GB data. and will use tempdb more .( sp and functions has @table variable and #temptables ) so temp db will grow more .Also my database log file too .As we dont need FULL backup. I used to run BACKUP LOG tempdb with NO_LOG and DBCC_SHIRNKFILE Is there any othe...more >>

filtering result set from a sproc
Posted by Iain at 7/27/2007 2:46:03 AM
I have a complex database structure from which I wish to create an excel like table with columns defined in the query (I pass in a string with the names of the columns in) and the rows filtered by more or less random criteria (which may require joins). For interest the source structure is e...more >>

trigger with query
Posted by Petra Meier at 7/27/2007 12:26:39 AM
Hi there, I have a problem, I have a masterTable to which I attach a trigger (update) as soon as rows are updated I want to update a second table (that has a completly different structure I only update parts of this 2nd table) further more I have to query the column name in the second table o...more >>

Adding a column to a table with a default date
Posted by Claire at 7/27/2007 12:00:00 AM
I need to create a column in a database from code. My application supports both MySQL and SQL server and Ive tested the following sql on MySQL without problems. string sql = string.Format("ALTER TABLE UsersCalibration ADD InductionDate DATETIME NOT NULL DEFAULT {0}" + " AFTER RangeLimit", ...more >>


DevelopmentNow Blog