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 > august 2006 > threads for monday august 21

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

CHARINDEX Fails with a Comma
Posted by Mike Harbinger at 8/21/2006 10:26:24 PM
I am trying to break a concatenated address into 3 separate strings starting with the street address. For example- From the following string: '191 S. Central Expwy., Suite 26-Lewiston, ME 89004' I am trying to parse: '191 S. Central Expwy.' Using: LEFT (StrAdd, CHARINDEX(',', StrAdd)-1 bu...more >>


Strange Data Entry Error
Posted by Dazza at 8/21/2006 7:20:17 PM
I have a database that I use to store infornation regards my DVD collection (sad I know!) and have recently added a new table that stores text regards "easter eggs" a DVD may contain. The table consists of the following: EggId INT IDENTITY(1,1) PRIMARY KEY NOT NULL DVDId INT NOT NULL Egg...more >>

Organize and Print CSV data
Posted by Jchick at 8/21/2006 7:18:21 PM
Boy, this should be a simple bit of code but I can't figure out how to make it happen. I have a CSV file shows up in a directory that has 4 fields that need to be printed on labels. Each line of the CSV looks something like this: AcctNo, Name, junk, junk, Address, junk, PhoneNo I need to...more >>

Reindex database script
Posted by Joe at 8/21/2006 6:55:11 PM
Pardon my stupidity, but I am new at SQL and I wanted to find out how to reindex a database. I have made a backup of it and I would like to reindex the whole database, not just a table at a time. I have this script from a website but it does not work, it bombs out on me. Any help is appreciate...more >>

returning status of an update
Posted by bic at 8/21/2006 6:13:04 PM
Hi, I need to update several columns of a row and then return the status of the update whether it was successful. I take it that I'd use a trigger to rollback the transaction and give a status of fail when the update is a no go. How would you script it? Thanks. -- bic...more >>

inner join using SubString
Posted by shank at 8/21/2006 5:28:50 PM
On the below, I'm trying to inner join on 2 fields. example data: stcdl.od = 'AZDB1234' itk.od = '1234' UPDATE itk SET itk.ta = stcdl.ta FROM itk INNER JOIN stcdl ON SubString(stcdl.od,5,4) = itk.od Obviously, what I'm trying to do does not work. What will work? thanks! ...more >>

Ummm, re delete statements?
Posted by rk rider at 8/21/2006 5:17:14 PM
I ran an delete statement and forgot to change one of my selection criteria before I hit F5 in query analyzer. I realized my mistake immediately and clicked cancel and it said 8500 rows affected. When I clicked cancel before the statement completed did it cancel and roll back the transaction o...more >>

distributed transaction error
Posted by Jim Underwood at 8/21/2006 5:11:13 PM
I am getting an error when trying to update my local server using data from a linked server. I query the server before beginning a transaction, and it appeared to work fine the first time I ran the code, but it fails every time after the first. I neither want nor need a transaction on the li...more >>



inserting into a table from another table
Posted by jbennett via SQLMonster.com at 8/21/2006 4:55:12 PM
ok i need to insert tracking numbers form our ups table into our shipping table. right now i have an update query that works it looks like this: update shmast set shmast.fmtrckno = upsin.fctrkno, shmast.fno_boxes = upsin.fnboxes,shmast. fshipwght = fnpkgwt, shmast.FSHIPMEMO = 'Amount: ' + ups...more >>

How to detect orphaned and correct records?
Posted by Bob at 8/21/2006 4:09:21 PM
I got a Parent table and one that should be a child table of it but found the relationship missing. The fields to create an maintain it are there but the relationship itself is missing. Since this is on a production environment I want to make sure that the records in te table are OK and if n...more >>

Implicit collation conversion?
Posted by Nils Magnus at 8/21/2006 4:03:27 PM
Hi, I have SQL Server 2005. I have a database "A" with the default collation "SQL_Latin1_General_CP1_CI_AS", and another database "B" with the default collation "Danish_Norwegian_CI_AI". I'm running a lot of "INSERT FROM B..table1 SELECT * FROM A..table2", and apart from the collation...more >>

Bulk insert format file not documented completely
Posted by DWalker at 8/21/2006 3:49:49 PM
I claim that format files for bulk insert and BCP are not documented completely or correctly. In SQL 2005 BOL, in the index under Format Files [SQL Server] subtopic Skipping Data Fields, the example shows 4 for the "number of columns" (the thing in the second row of the .fmt file). Wh...more >>

Help on select statement with aggregate function
Posted by Sarah at 8/21/2006 3:28:27 PM
Hi, I have a table like this: account#, invoicedate, product, invoice#, sales, quantity I like to find out one per account, on each product line, the price per quantity on each invoice on 05/01/06 and showing the total invoice sales and qty as well. The price should be sales/quantiey. ...more >>

Query comma separated values in a field
Posted by Jozza at 8/21/2006 3:16:50 PM
Hello all, I find myself before a riddle of building a query consisting of two tables where in one table field is a string with values separated by a comma. Like this: table1: Record1: Field Prefixes has a string value '25,36,47' Record2: Field Prefixes has a string value '55,66,27' an...more >>

Design question
Posted by Daniel at 8/21/2006 2:25:01 PM
Hey guys I have a multiplayer game application i coded. All data to and from clients goes through the server app i coded but i do have a database back end. i want the clients to be able to access their Gamehistory and so on which is in the database. My question is should i: a) Get cl...more >>

How to: SQL2000SP3 data change trigger batch or script
Posted by FifthGearTurtle at 8/21/2006 2:02:01 PM
Using SQL 2000 SP3 on Server 2003 Enterprise, on a change of data for a specific field can I get a trigger to run operating system shell command or script?...more >>

Why does Datalength always return 1024
Posted by Nitin at 8/21/2006 1:37:01 PM
I have a tbale with "Text" column. The datalegth always returns 1024 for that column? Any ides if this is a confiuration porblme.. I have SQL server 2000 8.x...more >>

connection string testing tool?
Posted by Johnny Ruin at 8/21/2006 1:27:59 PM
Hi, A user is having trouble using my app to connect to a SQL server database. My app reads a connect string from a file. Is there a easy way to have the user test the connection string using standard tools rather than my app? I'm looking for a way to say 'it's not my app'.... ...more >>

T-SQL Syntax in Stored Procedure Question
Posted by Steve Harp at 8/21/2006 1:20:39 PM
Hi All, I haven't used MS-SQL for many years and I'm now trying to port a Firebird database to MS-SQL 2000. Of course the syntax for store procedures and triggers is significantly different. I don't want to get into a here's_the_way_we_used_to_do_it_back_home pissing match, but here's an ex...more >>

SQL selection and Arrays
Posted by Michael Kintner at 8/21/2006 1:11:41 PM
I have a two tables: Users Table: UserName Security usr1 grp1,grp2 usr2 grp2 usr3 grp3 Menus Table: Name Security ABC grp1,grp3 DEF grp2 XYZ grp4 I want to display usr1 the menus that I can run. declare @s varchar(50...more >>

running a .SQL file
Posted by jaylou at 8/21/2006 12:54:01 PM
I am not sure if this is possible but here goes. I needed to import many DBF files into my SQL server 2000 database. DTS was not a good solution because the name of the DBF files vary and can change from day to day. I found a converter that converted the DBF file into a SQL script that cr...more >>

Drop Table using a variable
Posted by michael at 8/21/2006 12:27:02 PM
Is there a function that can take an @Variable that will drop a table? I can't seem to be able to get Drop Table @Variable to work because Drop Table doesn't want a string, it wants the plain table name. -- Michael Hockstein...more >>

Semicolon - Why?
Posted by Jordan S. at 8/21/2006 12:15:06 PM
Why does a semicolon appear at the end of some T-SQL statements in 2005 BOL? It doesn't seem necessary. ...more >>

parse a comma seperated values correctly into more then one column in a Table Variable
Posted by gv at 8/21/2006 12:03:03 PM
Hi all, Trying to parse a comma seperated values correctly into more then one column in a Table Variable. Credit goes to this site for part of the code http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm This is what I have: Run in Query analyzer..... Declare @Passedin_Li...more >>

Convert hexadecimal to varchar
Posted by stuart.karp NO[at]SPAM gmail.com at 8/21/2006 11:44:53 AM
Hi all, I need to convert a value in hexadecimal to varchar, and this does not seem to be as easy as DECLARE @hex varbinary DECLARE @str varchar SET @str = 'test' --PRINT @str SET @hex = 0x0000000000000001FFFF07D600002710 SET @str = CAST(@hex as varchar) Any ideas? Has anyone tried t...more >>

query to find uniue combinations only
Posted by VJ at 8/21/2006 11:00:32 AM
I have this data create table abc (a char, b char) insert into abc values ('a', 'b') insert into abc values ('b', 'c') insert into abc values ('c', 'b') insert into abc values ('b', 'a') I want to return only 2 values from all 4 since a b and b a are repeting what is the way to do ...more >>

Help: How to specify column data type when using BULK INSERT with txt file?
Posted by Hongbo at 8/21/2006 10:17:37 AM
Hi, Would you please tell me how to specify the column data type when using BULK INSERT to upload data from a tab determinate txt file? Thank you hb...more >>

How to select db's and table access for context user
Posted by r2thej151 at 8/21/2006 10:02:40 AM
Hi, I know they changed this a bit for 2005 so I am hoping to get a quick answer. I have a username and password for a user. With that username and password I will connect to a SQL Server. Next what I would like to do is query the server for all of the db id's and names this user has acces...more >>

Triggers
Posted by FARRUKH at 8/21/2006 9:55:01 AM
I have a questions and would greatly appreciate any help on this from the experts. I created a trigger (LOGtestfive) on table (testfive). How would I run this trigger? This trigger biscally displays the SQL statement, login name, user name and current time so I would like to monitor who mod...more >>

Blobs and SQL Server
Posted by bormesh NO[at]SPAM gmail.com at 8/21/2006 9:27:57 AM
Hello all, I'm looking for some information about storing BLOBs in SQL. A bit of background: my company is developing a document management system. Previously, we had stored the files on the file structure and used a pointer in the database. We're not switching because the next iteration of ...more >>

Views within views
Posted by Stephanie at 8/21/2006 8:45:02 AM
We have a large database that gets queried often for reporting purposes. For data access, we are limiting the users to views only, no direct table access. The view definitions can be quite complex, incorporating as many as 20 tables or more. We have been limiting the view definitions to con...more >>

Building a Ranking
Posted by João Costa at 8/21/2006 8:39:01 AM
Hello all I'm trying to build a ranking from a query with an order by of quantity desc. The result layout would be like this: Rank code quantity ----- ------ -------- 1 543 10000 2 989 5000 3 121 10 how can I achieve this result namely the Rank col...more >>

Naming Tables
Posted by robken at 8/21/2006 8:38:37 AM
Hi all, I'm in the process of creating a query to create, itterate and then update a group of 123 tables. Here is a shortened version of it to give you an idea of what I am trying to do... DECLARE @x as int SET @x = 1 SELECT identity(int,1,1), place1, place2, [value] *2 INTO flow1 F...more >>

Coalesce, Nulls, and Select statement Issue.
Posted by MichaelT at 8/21/2006 7:58:53 AM
Hello Fellow programmers, currently I am working a series of stored procs in SQL Server 2005 to gather record(s) from a database based on a set number of fields. All fields are not mandatory for the stored proc to work via the Coalesce function. If the param is not given a value it is assigned a...more >>

How to select batch from table?
Posted by yangshiyong at 8/21/2006 7:42:56 AM
Hi, I need to join two big tables and return all rows of the tables. The problem is the two tables are big so the performance of the query is very bad, I plan to select from one table in a batch, put the batch in a temporary table, join the temporary table with the other table, drop the temporar...more >>

Where all the SQL Server Logs could be found
Posted by Riaz at 8/21/2006 7:34:02 AM
I have two questions and would greatly appreciate any help on this from the experts. 1. Sql server Logs the information at many places, we are trying to consolidate them. So I would like to know all the sources from where we can get the SQL server logs without missing any log information. ...more >>

RETURNING NEWSEQUENTIALID() FROM A STORED PROC
Posted by mark_overstreet NO[at]SPAM compuserve.com at 8/21/2006 7:08:10 AM
I am trying to utilize the new GUID function on my tables (NEWSEQUENTIALID()) as my primary key field but I can't figure out how to return this value when I do an Insert in my stored procedure. Can anyone point me in the right direction? Thanks Mark ...more >>

Stored Proc Transaction Question.
Posted by LineVoltageHalogen at 8/21/2006 6:55:33 AM
Greetings All, I have a simple question (hopefully simple) that I am hoping has a simple answer. Let's say there is a C# application that calls a stored procedrue and it is wrapped in a transaction (from within C# the transactioin is initiated). If that stored procedure also had a transaction...more >>

Uncommited Transactions from the Query Analyzer
Posted by Jothi at 8/21/2006 6:41:02 AM
Hi All, I am connection to SQL Server 7.00 using a SQL Server 2000 Query Analyzer. When i run a simple select satement and close the Queiry Analyzer window i get the following message : "The are uncomitted Transactions do you wish to commit these Transactions before closing the WIndow". ...more >>

Locate triggers
Posted by FARRUKH at 8/21/2006 6:30:02 AM
I am using SQL Server 2000. Is there any scripts i can run and find out how many triggers in a database and n table I am a new DBA and I was told last DBA wrote some triggers on a certain tables so I want to locate those tables who has a triggers Farrukh...more >>

Backup database
Posted by gianluca.toni NO[at]SPAM gmail.com at 8/21/2006 6:14:11 AM
Hallo everybody. I am trying to make a schedule of database backup (SQL 2000). For technical point of view is very easy to configure that, but I have a doubt: which is tha best phylosophy for a complete backup ? My idea is: every 20 minutes backup of transaction log. (if I mantain 2 days,...more >>

No column was specified for column 2 of 'tableId'.
Posted by mamin NO[at]SPAM o2.pl at 8/21/2006 5:50:53 AM
Hi, I'm trying to execute the following query: select count(1) from (SELECT COL1,'aaa' + convert(varchar(255),COL2) from TAB) tableId As the table is empty, the following error message appears: No column was specified for column 2 of 'tableId'. What should I do to protect from such erro...more >>

sql2005 - send query results to a text file
Posted by xiangyap at 8/21/2006 3:05:01 AM
I couldn't find any commands in SQL that allow me to directly send my query results to a text file. I do not want to use command line utilities and command shell procedure calls such as bcp. I can easily do so in MySQL eg. SELECT * FROM CUSTOMER TO OUTFILE TEST.TXT. Would appreciate as...more >>

UPDATE function
Posted by robken at 8/21/2006 3:03:48 AM
Hi. I'm trying to do a pretty big update command and I'm looking for a way to do a batch update rather than having a seperate update comand for every row. Take the following two tables as sample data... table 1: place ratio ----------- --------------------------------------- 1 ...more >>

Please guide me..
Posted by arijitchatterjee123 NO[at]SPAM yahoo.co.in at 8/21/2006 2:59:36 AM
Hi Team, Can you please guide me why this portion of code generating errors? ===================================================== Declare @Where varchar(2000),@Query Varchar(8000),@outerQuery varchar(8000),@outerOrder varchar(8000),@rowCount int,@NQuery nvarchar(4000) Select @Where = ' where ...more >>

Making a table of all possible combinations of data from two tables
Posted by Smokey Grindle at 8/21/2006 12:00:00 AM
I have the following tables, and want to make it so that you get a combination of all possible values from the child table (RateCriteriaValue) based on the possible items in the parent table (rateCriteria) so for example if I had these two items RateCriteria - Cr1 - Cr2 and these value...more >>

Update Q.
Posted by evgenybr via SQLMonster.com at 8/21/2006 12:00:00 AM
Hi All, i should perform update to table of next sructure: Table1 ID | VALUE -------- | ------------- 1 | aaaaa 1 | bbbbb 1 | cccccc 2 | ssssss 2 | eeeeee ............................ ............................. ID ...more >>

How can LDF file size smallerr
Posted by kimsin_sen at 8/21/2006 12:00:00 AM
Hi Everybody, I use MSSQL 2005 so LDF File size 116 GB and MDF file size only 2 GB How can i smaller LDF file size or empty PS: Error Code Autogrow of file 'MgzPro_L' in database 'MgzPro' was cancelled by user or timed out after 523047 milliseconds. Use ALTER DATABASE to set a smaller ...more >>

t-sql cursor
Posted by Shane Hooper at 8/21/2006 12:00:00 AM
Hello, I am using SQL Server 2005. I want to write t-sql procedure to return a record from one table and copy some of the fields to a new record in another table. (Copying part data to a Purchase Order). The only way I can see to do this is using a Cursor or a temp table. However it seems that...more >>

case
Posted by Shane Hooper at 8/21/2006 12:00:00 AM
Hello again, This time I am trying to use the case statement to determine an update. It won't work. It seems that case will only work with a field from a table and not a passed variable. Is there any way to make this work?: ALTER PROCEDURE [dbo].[spSupplierOrderDetail_AddUpdate] -- Add the...more >>


DevelopmentNow Blog