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 > june 2005 > threads for thursday june 23

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

Make Labosh - Follow up
Posted by Reggie at 6/23/2005 11:29:28 PM
Mike sorry for posting directly to you, but you gave me some good advice a couple days back and I have a few questions for you. Original Thread: > Hi and TIA! I have an ASP.Net page that when the user clicks a button a > recordset is passed to a stored procedure(this is what I'm trying to do...more >>

help with a comparison and select
Posted by The Gekkster via SQLMonster.com at 6/23/2005 9:48:26 PM
Hey all, I'm trying to figure out how to compare one character string against a list (of other strings) and then select a 'best' match. I'm not really sure how to go about doing a 'best' comparison/selection. No doubt I'll have to tweak the logic for 'best' as I work with this over time. Th...more >>

MSDE, ASP.NET, Visual Studio .NET, and connectionstrings
Posted by Nathan Sokalski at 6/23/2005 6:45:34 PM
I have Visual Studio .NET and SQL Server Desktop Engine on my computer. I have created an empty database using Visual Studio .NET's Server Explorer. However, I am having trouble connecting to the database using ASP.NET. I think the problem is somewhere in my connection string, but because I do no...more >>

Pulling Table definitions as scripts
Posted by Jonas Larsen at 6/23/2005 5:48:03 PM
Hi guys I am trying to get 'create table' statements for all tables in a database. I know I in QA can right click a specific table and get QA to generate a script for creating that table. However I have a long list of tables that I need to script so does anyone know how to generate these sc...more >>

Case Statement
Posted by Ed at 6/23/2005 5:19:03 PM
Is case statement a ANSI-92 standard? Where can I find the list of ANSI standard anyway? Thanks Ed...more >>

Adding values to Newtbl NOT NULL col
Posted by Ant at 6/23/2005 5:06:02 PM
Hi, I'm quite new to SQL. I've created a new table & need to populate it with some cols from another table. I want to add an incrementing value to a NOT NULL col of the new table for each row added. I'm trying to do it like this: (This is eqivelant to the value I'm inserting as a sub query...more >>

Mailbox to SQL format
Posted by Jsalmeron at 6/23/2005 4:26:04 PM
I need to convert a mailbox to a SQL database, I need to have all the fields including the attachments...more >>

Update Trigger
Posted by Konstantin Loguinov at 6/23/2005 3:38:18 PM
Folks, Is it possible to write a trigger that updates time/date stamp for the record that was just updated? I'm a bit new to all this and the simple trigger I wrote updates time/date for ALL records if one is updated. That's not what I need. Thanks! Konstantin ...more >>



problem using parameter with Stored Proc in Query Analyzer
Posted by Rich at 6/23/2005 3:22:04 PM
In query analyzer I do this ---------------------------------------------------------- Create Procedure stp_TestProc @i int As Select * From tbl2 Where fld1 = @i Go --------------------------------------------------------- but I get the following error message when I try to run the foll...more >>

Copying specific table Indexes from one DB to another
Posted by MikeS at 6/23/2005 3:14:01 PM
I am trying to use a dynamic query within a stored procedure to copy tables from one database to another. I am simply using the "Select * Into database2.dbo.DynamicTableName From database1.dbo.DynamicTableName" query. The problem is that my indexes don't follow using this method. Is there a...more >>

Can You solve...
Posted by Bpk. Adi Wira Kusuma at 6/23/2005 2:55:51 PM
I execute this syntax in Query Analyzer. SELECT * FROM TB1 WHERE NO_ID IN (SELECT NOID FROM TB2) In the past, I always executed this syntax, and it's ok. But now, I get error message: Server: Msg 446, Level 16, State 9, Line 1 Cannot resolve collation conflict for equal to operation. ...more >>

Question with Profiler
Posted by Ed at 6/23/2005 2:52:05 PM
Hi, I just find out something very interesting, maybe it is just my misunderstanding When I use Profiler to capture the Stored Procedure and sql statement, i use SQL: StmtCompleted RPC: Completed SQL: BatchCompleted SP:Completed and I go to the front end application and try to call t...more >>

Dynamic SQL in SP?
Posted by SteveInBeloit at 6/23/2005 2:32:03 PM
Hi, I am writing a form that is based on a Stored Proc. I have several search fields that the user can or cannot enter, in any combinations. I want to send those to the stored proc and return the rows that match the search fields they entered, or get all rows if they do not enter any. I ...more >>

Query to Generate a unique value
Posted by Chris at 6/23/2005 2:26:38 PM
Scenario: In a table I have two columns MyDate (datetime) and MyValue (varchar 20). I have the following data:- MyDate MyValue 1/1/2005 Test 2/1/2005 Test 2/1/2005 Test2 2/1/2005 Test3 I have a constraint that insists MyDate and MyValue combinations are unique. I want to in...more >>

Enable Line Numbering in SQL Query Analyzer Editor
Posted by Concatto at 6/23/2005 2:22:01 PM
I'm trying to write a SQL stored procedure using the editor in the SQL Query Analyzer, does anyone know how to enable the Line Numbering within the editor? -- Regards, ConCatto...more >>

simple sql select
Posted by Aleks at 6/23/2005 2:01:39 PM
I have an sql to select 'customers', something like Select * from clients inner join cases on clients.id = cases.clientid The client may have multiple cases and if I run the query like that I may get the same client multiple times, how can I only display the client once when there are multi...more >>

table relationship
Posted by Souris at 6/23/2005 1:30:01 PM
Hi All, I had 2 tables with paent child relationship. When I wanted to link them I got following message 'MYPARENT' table saved successfully 'MYCHILD' table - Unable to create relationship 'FK_MYCHILD_MYPARENT'. ADO error: ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constr...more >>

BCP and ISQL question
Posted by Zev at 6/23/2005 1:28:47 PM
I was trying to export some data using BCP to a text file. The command line prompt was running locally and the DB server is remote. The line I was running was: bcp.exe dbname..tablename out /t"\t" /r"\n" /o c:\test\bcptest.txt /S servername /U sa /P password When I run this, the file is c...more >>

output stored procedure not outputting varchar value
Posted by Rich at 6/23/2005 1:14:02 PM
The sp returns 1 int value that I will convert into one comma delimited string (eventually the sp will calculate 3 separate int values) - varchar so that I don't have to use a table to collect the int values. I run the sp in query analyzer below but only get a 0. How can I get the string? ...more >>

Q: Column Placement in Alter Query
Posted by Richard J at 6/23/2005 1:07:02 PM
Group, When we run an ALTER TABLE query, is there anyway of specifying where the column is to be placed? Normally, any new column is appended to the end of the table, but is there a way to place a new column to the beginning of a table definition without dropping the table and recreatin...more >>

JDBC Driver bug
Posted by Rizwan at 6/23/2005 12:33:32 PM
I am not sure if this is the right forum for my question but here it is anyway: I am using Microsoft SQL Server 2000 JDBC Driver with my java code. I found a bug in this Driver. Suppose I update a table through this Driver and this table has trigger (INSERT/UPDATE) on it. If somehow the trigge...more >>

clustered index on view - problem
Posted by Random at 6/23/2005 12:17:27 PM
I have a base table and a view that I need to put an index on. The TSQL for the table and view are thus... CREATE TABLE dbo.NAICS ( sector char(2) NULL, naicsCode char(4) NULL, naicsName varchar(150) NOT NULL, sort_exception bit NOT NULL, sel_exceptio] bit NOT NULL, sector_referral...more >>

Laptops for programmers?
Posted by et at 6/23/2005 12:09:26 PM
I need a strong sturdy speedy can-do-it-all laptop that works well for programmers doing sql & .net. Any advice, suggestions? What to get, what not to get? Thanks and I am cross posting on the dotnet.framework.aspnet group too. ...more >>

Possible to ensure a query scans by keys sequentially?
Posted by Mark Findlay at 6/23/2005 11:57:54 AM
Is there a way to ensure that SQL Server performs a query by scanning each row in my table, key by key sequentially? Either programmatically or by configuring my table? My customer table (10,000 rows) has a customer ID field which is a unique number. I want to display the table on a web pag...more >>

Loss of datetime precision when attaching parameters to an ADO.NET command
Posted by Chris Lacey at 6/23/2005 11:46:19 AM
Hi, I am encountering some strange losses of datetime precision when calling a stored procedure through ADO.NET. I'm using ExecuteNonQuery in the Microsoft Data Access Application Block for .NET, which simply creates an ADO.NET command, and attaches each of the parameters, before calling ...more >>

Creating dynamic views using sp by passing a parameter
Posted by Rajesh at 6/23/2005 11:41:03 AM
Hello Sql Gurus, 1. Is it possible to create a static view in an sp. sql 2000 sql 2005 2. Is it possible to create a dynamic view by passing a parameter to an sp. sql 2000 sql 2005 Create Proc testproc ( statecd char(10...more >>

Simple select query
Posted by Aleks at 6/23/2005 11:38:21 AM
I have an sql to select 'customers', something like Select * from clients inner join cases on clients.id = cases.clientid The client may have multiple cases and if I run the query like that I may get the same client multiple times, how can I only display the client once when there are mul...more >>

SPROC Date Filter
Posted by Scott at 6/23/2005 11:38:14 AM
I'm using a SPROC that works great except when I try to filter by date. In CODE 1 below, the @sFilter param works fine, but in CODE 2, the @sFilter returns no records from Northwind prior to 1/1/1998. What syntax is SQL wanting from me? I've even tried the @sFilter = OrderDate < CONVERT(DAT...more >>

problem running output stored procedure in VB6 ADO
Posted by Rich at 6/23/2005 11:35:01 AM
I have an output stored procedure on Sql Server 2000. It works fine in query analyzer. ------------------------------------------------------------------------------ create procedure stptest @count int output as select @count = count(*) from (select fld1 from tbl1 where fld1 not in (sel...more >>

Passing input and output in the same parameter?
Posted by Snake at 6/23/2005 11:19:02 AM
is it possible to define a stored procedure parameter to act as both input and output? I have a requirement to pass a value in but on some conditions return a different value in the same parameter. BOL appears silent on this issue. Thanks, Michael...more >>

Convert Datetime to Decimal
Posted by Ian D McLean at 6/23/2005 11:16:01 AM
Hi, I'm sure this question has been asked a hundred times but a quick search in this newsgroup hasn't come up with any answers. I want to create a formulated column which gives me the result of the difference between 2 datetime columns in a decimal format (e.g. 24/06/2005 02:00:00 - 23/0...more >>

Performance Issues for Huge Data import/insert
Posted by Permood at 6/23/2005 10:54:01 AM
Hi Experts, I need to insert 60 millions records or 6GB Fixed width text File into SQL Server 2000. There are some problems with data, like date columns are in 6 char (mmddyy format) which needs to be convert into mm/dd/yyyy format and etc. Currently we have SQL scripts which import all d...more >>

question about database ownership
Posted by Britney at 6/23/2005 10:52:17 AM
Hi everyone, I have question about database ownership. We have a database called "price" "price" db was created by someone (John Doe) before, who is no longer working for our company. So in enterprise manager, I right-clicked on database "price" and go to property page, I see owner a...more >>

syntax problem with query
Posted by Rich at 6/23/2005 10:23:04 AM
>> Server: Msg 170, Level 15, State 1, Line 4 Line 4: Incorrect syntax near ')'. << Here's the query select count(fld1) from (select fld1 from tbl1 where fld1 not in (select * from tbl2) or fld1 is null) Based on the data below, if I run just select fld1 from tbl1 where fld1 not in (s...more >>

List tables with identity
Posted by David C at 6/23/2005 9:50:39 AM
Is it possible to list all tables in my 2000 database that have identity fields? I need to change some before replication. Thanks. David ...more >>

Different resultsets with BETWEEN and <> operators
Posted by Earl at 6/23/2005 9:49:07 AM
I'm getting a different resultset for queries using BETWEEN than I do using the less than and greater than operators. My BETWEEN resultset has 0 records and the resultset using the operators has 2500. Any thoughts? CREATE TABLE [dbo].[Prospects] ( [ProspectID] [int] IDENTITY (1, 1) NOT FOR...more >>

Import TXT FIle
Posted by Supermario at 6/23/2005 9:23:11 AM
Hi I would like to import data from a TXT file, and insert the data into a table. I would like to do that with osql Can you help me ? best regards Frank...more >>

Simple 3-Way Join and Case question
Posted by roy.anderson NO[at]SPAM gmail.com at 6/23/2005 8:48:32 AM
Hey all, The first 8 lines are fairly self-explanatory and work just fine. Line 9 is where the issue lies. What I'm trying to do with the case statement is produce a query wherein IF t3.van_type LIKE '%REF%' THEN the WHERE clause should read as "datediff(day,t2.maxi_dt,t1.sched_deprt_dt) > -1" ...more >>

How to have same Data in Test db and Prod db
Posted by vijay at 6/23/2005 8:46:02 AM
Hi, Are there any tools which can dump data from Prod db into Test db, or any other method so that the data in Test db is same as Prod db. Thanks Vijay...more >>

Pivoting?
Posted by Buggyman at 6/23/2005 8:35:04 AM
Hi, Lets say I have the following simple table.. create table foo ( bar integer not null ) How can I select so that I get a single comma seperated result of all the values? i.e. if ... insert into foo values (1) insert into foo values (2) insert into foo values (3) and yet I ...more >>

spaces in fields
Posted by childofthe1980s at 6/23/2005 8:11:06 AM
Hello: I realize that this is "off of the subject", but I do not know where else to go. When I try to pull a field onto a Crystal report and then refresh the report, I get a SQL ODBC error that says "Incorrect syntax near the keyword...". The field is a two-word field in SQL called "P...more >>

Deleting Entire Database
Posted by RogueIT at 6/23/2005 8:09:04 AM
I am looking for a to remove a whole database altogether programmatically. I am talking structure and data. I want nothing left. I realize that I have to stop the service first but after that I am at a loss thanks in advance, RogueIT...more >>

Naming the resultsets in a Stored Procedure
Posted by Karsten Lundsgaard at 6/23/2005 7:50:09 AM
Hi, does anybody knows how I can name a resultset in a Stored Procdure. I would like to be able to type this i C# : Dataset.Tables["MyResult"]... instead of Dataset.Tables[0].... It could be some thing like this : (Select * from SomeTable) as MyResult I hope s...more >>

Last 5 Receipts
Posted by Concatto at 6/23/2005 7:30:06 AM
I have 2 tables: Suppliers: SupplierID(key), SupplierName, SupplierAddress, … Receipts: SupplierID(key), ReceiptNumber(key), DateTime, PartID, Quantity I want to select the last 5 receipts for each supplier and return the following information: SupplierID, SupplierName, ReceiptNumber, Date...more >>

Optional parameters in stored procedure.?
Posted by Chubbly Geezer at 6/23/2005 6:55:03 AM
Can anyone tell me if these are possible in SQL and if so how do I declare them. thanks...more >>

How do I select the TOP 1 of EACH unique ID?
Posted by l.woods at 6/23/2005 6:31:07 AM
I have a table with UserID, "other values". I have sorted this result set in UserID order, therefore I have a result set: UserID 11111, .... 11111,..... 22222,..... 33333,..... 33333,.... Now, I want the FIRST value from each UserID field; i.e., drop duplicate UserID rows. How? ...more >>

Database Hosting
Posted by Moorthy at 6/23/2005 6:21:01 AM
Hi I'm migrating database server from one server to another. During this process i'm unable to host my database to the new server. I often get "PERMISSION DENIED (Error 229)". Can any one suggest to me? ...more >>

Encrypted object is not transferable, and script can not be genera
Posted by Enric at 6/23/2005 6:08:02 AM
Dear all, When I try to open some stored procedure i receive the following error: “Encrypted object is not transferable, and script can not be generated” What the hell is happening? I might say that everything is fine but... Thanks in advance and best regards,...more >>

Distributed transaction problem
Posted by nomi at 6/23/2005 5:54:03 AM
Hi everybody, When i run this query Select * into #user_tbl from OpenDataSource('SQLOLEDB','DataSource=DBServer;User ID=sa;Password=sa').USERDB.dbo.user_tbl from a Query Analyzer window it runs fine. However when i use the same statement in a stored procedure using dynamic sql like...more >>

T-SQL - truncate digits right of decimal
Posted by SteveInBeloit at 6/23/2005 5:43:02 AM
Hi, In a stored proc, I have the following in a SELECT statement, CAST(dbo.tblPackaging.pkgPCLength AS varchar(18)) + (SELECT CASE WHEN dbo.tblPackaging.pkgUM = 'F' Then ' Ft.' ELSE ' In.' END) AS txtPcLength pkgPCLenght is defined decimal(12,6) - what the above returns is 1243.00000...more >>

How do I "group" within "group"?
Posted by l.woods at 6/23/2005 5:10:22 AM
I have a table of sales information: EmployeeID int Sale single Date date I want to create a recordset, based upon a YEAR date range: EmployeeID Sum of Sales Year Sample input records: 11111,10.00,#4/5/2004# 11111,4.95,#1/15/2005# 11111,6.00,#6/6/2005# (obviously, LOTS of em...more >>

Tracking database object changes please
Posted by Steve'o at 6/23/2005 3:46:03 AM
Server = SQL Server 2000 SP3a + Windows 2000SP4 Is there a way to view who / what and when database objects have been modified. Im trying to figure out if someone is messing around with things like triggers on tables, as simple things like a trigger "After Insert, Update" strangely chan...more >>

Select Random Records
Posted by dhnriverside at 6/23/2005 3:21:02 AM
Hi I want to be able to select 10 random records from my table for display on my asp.net page. The idea is that each time the page is viewed, a different selection of records is viewable. How can I achieve the select 10 random records sql statement? Cheers Dan...more >>

T-SQL doubt..
Posted by Daniel at 6/23/2005 1:15:02 AM
Hi, May i know the below sentence is correct: select [a.column/c.column] AS D From a,b,c where a=b and b=c If it is not possible, what is the correct way..?? thanks in advance. Daniel....more >>

Windows Authentication Possible ?
Posted by hals_left at 6/23/2005 12:06:00 AM
Hi, I have a SQL Server setup to use windows authentication to accept adodb connections from an intranet in IIS. While SQL/IIS are on the same machine it uses the following connect: Provider=sqloledb Data Source=(local) Initial Catalog=Intranet Integrated Security=SSPI Remote users f...more >>

SQL Needed
Posted by Ahmed Hashish at 6/23/2005 12:00:00 AM
Suppose I have a master Table A(EmployeeID,EmployeeName) and transaction Table B(EmployeeID,TransCode,TransDate,Amount) I want to to create sql that returns each employee with his last transaction and transaction amount and code The Final result must be a datasheet like This: EmployeeID ...more >>

is there a procedure which can initialize the identity field to original value?
Posted by billkim at 6/23/2005 12:00:00 AM
after delete the table (declared varible), i want to set the field with identity property to 1,is there any system procedure can do this? RGDS bill ...more >>

Question about xp_cmdshell
Posted by lamchan at 6/23/2005 12:00:00 AM
I'm trying to execute an exe file using the stored procedure "xp_cmdshell". The exe file is a simple program creating an icon in the system tray. I found that after executing the command " exec master..xp_cmdshell 'test.exe' ", the program is lauched in the background which can be found in the ta...more >>

Image and text fields in a Update, delete trigger
Posted by Henrik Skak Pedersen at 6/23/2005 12:00:00 AM
Hi, How can I access Image/text fields from the deleted/inserted tables in a trigger? I want to access both if it is a update. Thanks Henrik ...more >>


DevelopmentNow Blog