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 2007 > threads for wednesday october 31

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

consolidating rows
Posted by SteveH at 10/31/2007 9:44:21 PM
I have inherited a system that has a table with 9.7 million rows which grows by around 5,000 a day. (SQL 2005) A record is written for each episode every time the unit/ward/doctor changes as well as at 07:00, 15:00, 22:00 and 00:00 each day (changes in shift) Here is a sample episode un...more >>


how to insert into index
Posted by Andy at 10/31/2007 8:41:31 PM
Hi, I have some table in old DB with column named "index". How to write insert statement to not get an error? if I try to do that SQl Server is saying "error near index...etc" insert into table (index, name) values (1,'Bob') got to be some workaround? thanks ...more >>

October CTP?
Posted by Mike C# at 10/31/2007 7:48:03 PM
Anyone know if there is going to be an "October CTP" for SQL 2008? ...more >>

Fastest way to move XML document into and back out of CLR function
Posted by DR at 10/31/2007 6:42:04 PM
Fastest way to move XML document into and back out of CLR function In SQL Server 2005 and Visual Studio 2005, what is the fastest way to pass an xml data type variable into a C# CLR function and retrieve it back out of the C# CLR function when the C# CLR function is done modifying it? I tr...more >>

Acess SQL Code to SQL Server Code
Posted by haganahtrainer NO[at]SPAM gmail.com at 10/31/2007 5:25:20 PM
Are there any conversion utilities that will convert access sql code to sql server 2005 code? ...more >>

how to determine how many milliseconds a segment of code takes to execute in TSQL on sql server 2005?
Posted by DR at 10/31/2007 3:09:47 PM
how to determine how many milliseconds a segment of code takes to execute in TSQL on sql server 2005? ...more >>

converting money format to text
Posted by Eric Bragas at 10/31/2007 3:08:16 PM
Hello, I need a clear and uncomplicated method to display money values in text reports. For instance, $1.98 and $0 and $.90 should go in characters 3 to 12 (column 2 of 3) in the following format: TX 198column3 value x CA 0column3 value y PN 90column3 value z I've ...more >>

Using Input Params in a Stored Proc
Posted by maa at 10/31/2007 2:44:00 PM
I have input params that can have values (1,2,3,...) or be null. They will be used in searches. My problem is I am using copy and paste code with parameter checks: if(@dt is null) Begin ... -- @dt is not used if(@dt is not null) Begin ... where dt1 > @dt ...more >>



question on commit
Posted by Jason at 10/31/2007 1:50:00 PM
Commit: When using SS when is a commit needed? e.g. if I open a QA session and delete some rows for a table, when does that delete become permanent? ...more >>

Query Help Find Max
Posted by _dino_ at 10/31/2007 12:22:55 PM
Hi Everyone, Please could somebody help me with this problem. I think it should be simple but I am missing something: Assuming I have a query that returns something like this: item weight trip 1 20 5 2 40 5 3 25 5 How do I write query ...more >>

How to quickly and easily build a customer-based Multi-million dollar company
Posted by bwm6kxjq at 10/31/2007 11:59:36 AM
Your product/service may be outstanding, but it's the number of quality customers that you gather that will ultimately turn your business into a multi-million dollar empire! I'm not talking about a few hundred leads .... but a database of 50,000 high-quality customers. Or to put it another ...more >>

Cursor question
Posted by Derekman at 10/31/2007 11:35:04 AM
I have created a cursor that uses sp_send_dbmail to mail out an e-mail and then insert the values into a table, the values are supplied from a temporary table which is populated with a SELECT statement. The issue that I am having is that the last value is always repeated, two e-mails are sent...more >>

TSQL Having question
Posted by Liz at 10/31/2007 10:49:00 AM
SQL 2000 v4 How can I get the value used in the having clause? Once I've identified the elig_ids that have 2 or more servicedates, I need both the elig_id and the servicedate that contains 2 or more. I don't necessarily need the dupes, one record will suffice. I just can't figure out how to...more >>

Generate Table DDL
Posted by Brad Wery at 10/31/2007 10:37:21 AM
Good Morning, I was wondering if there are any instructions or scripts available that would allow me to generate table DDL syntax from SQL Servers system tables\views? I created my own query tool (just for fun) and one of the features is allowing the user to view DDL from the database. T...more >>

Record Set Differences
Posted by randy.buchholz at 10/31/2007 10:32:44 AM
Not very good with SQL and need a way to identify the differences between two records based on selected subsets in a single table. . Set 1 is the items in an existing Request and Set 2 is a new Request. I need to identify the deltas. The problem is to identify three types of records - rec...more >>

DTS export to .txt file error
Posted by asleepatdesk at 10/31/2007 10:19:14 AM
My SQL database was created using the Access utility to convert an Access database to SQL. On the SQL Server, I have a DTS package that exports the entire contents of a SQL Server table to a fixed- length .txt file with CRLF row delim. The exported table's last column is a field that was an Ac...more >>

Trigger Help Please
Posted by Mangler at 10/31/2007 9:58:54 AM
I havent messed with triggers before so I am hoping I can get some help on this... I am assuming that what I am trying to do is easy.. First off, I have a test table to just play with temporaily and a real table that will hold the trigger... here they are: CREATE TABLE [dbo].[sku_info]( [id...more >>

Invalid SubSelect still executes?
Posted by chrisredburn at 10/31/2007 9:43:02 AM
Hi I have 2 tables CREATE TABLE a ( rowid uniqueidentifier not null, numericid int not null ) CREATE TABLE b ( rowid uniqueidentifier not null sometext varchar(10) not null ) foreign key of b.rowid to a.rowid Table a contains insert (rowid, numericid) values (1306, 'F122BF2...more >>

CAN NOT ALTER TRIGGER IN 2005
Posted by weileogao NO[at]SPAM gmail.com at 10/31/2007 9:00:41 AM
I created a trigger in SQL 2005 and wanted to use ALTER statement to update it. But It did not work. I have to drop it and recreate it. It is odd, isnot it??????? Does anyone know this? Thanks in advance. Wei ...more >>

Is collation the answer?
Posted by Jon Rowlan at 10/31/2007 8:34:36 AM
I have a SQL 2005 based database and I want it to be able to support accents and graves etc from the Polish language in a varchar. I do not want to use nvarchar If I change the language and/or collation sequence will I be able to stored accented strings to a varchar field. If so, is it ...more >>

Use Like to search string
Posted by huohaodian NO[at]SPAM gmail.com at 10/31/2007 8:27:21 AM
Hi, I have a table with a field called caption when I do declare @name varchar(3) set @name = 'ED' if exists ( select * from Group where (caption like @name + '%' )) print @name else print 'not found' if 1 = ( select count(*) from Group where (caption like @name + '%' )) prin...more >>

Next Month
Posted by BLAW at 10/31/2007 8:09:19 AM
I have a date that I am using as part of my select statement: DATEADD(YEAR, 2, a.SurveyDate) I need to restict the results of my query to only start with displaying next month. I need to add two years to every surveydate and only display results begininng with next month. In other words t...more >>

How to remove a column with only NULL values?
Posted by francis.moore NO[at]SPAM gmail.com at 10/31/2007 7:26:57 AM
Hi, Is it possible to remove a column from a view (or even a SELECT) that only holds NULL values? Example: ID Value1 Value2 1 A NULL 2 NULL NULL 3 C NULL I only want to display the ID and Value1 columns because the Value2 column holds nothing...more >>

newbie: simple syntax error
Posted by R.A.M. at 10/31/2007 5:56:49 AM
Hello, I have a syntax error in IF that I do not understand. I marked the error in attached source code. Please help. The following stored procedure generates new number for Documents, according to DocumentsNumbering table (with columns: DocumentYear PK, StartingDocumentNumber, DocumentN...more >>

Recurring problem
Posted by iporter at 10/31/2007 5:44:24 AM
Often, I find my SQL queries doesn't return data in a format useful in my code due to joins. For example, imagine I have a Pen product and a Paper Product. The first has variations Color and Size, the second just Size. When I select products from the database, I get a list where pen appears ...more >>

query help needed
Posted by icf at 10/31/2007 5:44:01 AM
Hello, Here is DDL CREATE TABLE "dbo"."Contract" ( "System_ID" CHAR(3) NOT NULL, "Material_Number" CHAR(18) NOT NULL, "Cust_Number" VARCHAR (18) NULL, "Date" DATETIME NULL, "Sales_Eur" NUMERIC(15,5) NULL ) ; and sample data "System_ID" "Material...more >>

inserting from a select depeding of parameter value
Posted by greatdane at 10/31/2007 4:31:01 AM
Hello: I need to print labels via Report Services and one of my parameters is how many copies I should print. I could print one label with the same data or decide to print the same label in the same label sheet more than once. I have a sql statement to insert from a select. I need help to se...more >>

Do I have to use trigger to pull from inserted table?
Posted by Ronald S. Cook at 10/31/2007 3:30:09 AM
I would like to write a stored proc that inserts a row into a table. The table's PK is a GUID with newid() set to auto generate a value. I would like the proc to then return the GUID after the insert. I thought I could do something like: INSERT INTO Employee(EmployeeFirstName) VALUES (...more >>

Stored proc from ASP.NET
Posted by Marine at 10/31/2007 12:18:15 AM
Hi, I have 3 stored proc to view from an ASP.NET website. What is the most efficient : To run the 3 stored proc from the ASP.NET, or to make another stored proc running the 3 others from the Sql Server and run this new stored proc from the ASP.NET ? Thanks for helping ! ...more >>

hmmmmmmmmmm
Posted by Michael C at 10/31/2007 12:00:00 AM
"Q7: I would like to change my user name, how can I do it? A: Unfortunately, it is not possible due to technical reasons (because of the way GameKnot stores and references the user data on the server) -- your user name is permanent and cannot be changed." Gotta love the natural key crowd :-)...more >>

Preventing automatic rollback of transactions
Posted by (O)enone at 10/31/2007 12:00:00 AM
I am experiencing a problem with transaction handling in my SQL Server-based application. To demonstrate the problem, here are some simple T-SQL statements, which can be executed one by one in SQL Server Management Studio: \\\ -- Get the current transaction count, which is of courser zer...more >>

DateTime Conversion!!
Posted by Vai2000 at 10/31/2007 12:00:00 AM
I have a datetime column when I pass date value, it bails out.. Convert doesn't works convert(varchar(20),@myDateColumn,101) cast doesn't work!!! cast(@myDateColumn as smalldatetime) datepart works but fails when you have spanning months [oct-nov] what's the solution??? TIA SQL2000 ...more >>

FULL TEXT SEARCH - PROBLEM
Posted by at 10/31/2007 12:00:00 AM
I have query like that SELECT Urun_ID ,Urun_Ad FROM TBL_URUNLER WHERE CONTAINS(Urun_Ad, '"*mta1000-*"' ) it returns 62 MTA1000-1 When i chance the search phrase mta1000-1 it returns nothing. Urun_Ad is defined as NVARCHAR(50) in my tbl_urunler tabl...more >>

Especial characters
Posted by Cesar Gonzalez at 10/31/2007 12:00:00 AM
Hello Somebody knows as I can keeps Chinese characters in a data base SQL? My necessity is to be able to as much send reports in English as in Chinese ...more >>

Bulk insert from variable, not file?
Posted by Jeff.Mlakar NO[at]SPAM gmail.com at 10/31/2007 12:00:00 AM
Is there a way to bulk insert from a variable, not a file? Example: Instead of this: BULK INSERT [dbo].[Inventory_ent_Load_25] FROM 'c:\hold\Data.txt' WITH ( FORMATFILE = '\\sdvipp1\SQLFormatFiles\CanonicalInventoryBase.FMT', TABLOCK ) This: BULK INSERT [db...more >>

SET ANSI_PADDING
Posted by Graham Jones at 10/31/2007 12:00:00 AM
Hello, I am a bit confused. The documentation recommends having set ansi_padding on, and I agree. But if I create a new database in Studio the SET ANSI_PADDING option is by default false. This makes no sense to me, surely if they recommend it being on then a new database should have it t...more >>

Maximum number of concurrent users on the site
Posted by Meir Szydlo at 10/31/2007 12:00:00 AM
Hi, I need help with an interesting query, I have a table containing Login and Logout times, I need to know the maximum number of concurrent users (maximum number of users connected on the same time) Thanks Meir CREATE TABLE [dbo].[LogTimes] ( [LogTimeId] [int] NOT NULL , [UserId] ...more >>

Check Constraint not working
Posted by Chris at 10/31/2007 12:00:00 AM
I've just created a check constraint... ALTER TABLE [dbo].[Tours] ADD CONSTRAINT [CK_Tours_VehicleSeatAllocation_SeatingPlanWebsite] CHECK (([VehicleSeatAllocation] is null and [OwnAgentsSeatingPlanWebsite] = 0 and [OtherAgentsSeatingPlanWebsite] = 0 and [DirectSeatingPlanWebsite] = 0) or ...more >>

Best practices: Create schema or new database?
Posted by Joe at 10/31/2007 12:00:00 AM
I'm customizing an ERP application that has a SQL Server 2000 back end. I need to create a few views, stored procedures, and tables in the database to support my customization. In an effort to logically separate my custom additions to the application's database entities (which are in the dbo s...more >>

Keeping Table on Two Separate Servers in Sync
Posted by NigelA at 10/31/2007 12:00:00 AM
I have two SQL2000 servers. I have a database on each server, let's call them DatabaseA and DatabaseB. Each databases has a table with identical structures, lets call them TableA and TableB. As records are inserted into DatabaseA.dbo.TableA, I want them to appear in DatabaseB.dbo.TableB as soo...more >>


DevelopmentNow Blog