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
August 2008


all groups > sql server programming > august 2005 > threads for friday august 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

How to insert an image into a table??..is it possible to insert??
Posted by saroja at 8/5/2005 11:56:38 PM
I have a created a table pub_info with two fields 1.pub_id string 2.logo image ...now i want to insert images into logo column and i want to retreive that into my c#.net program...How can i do that??..please help...more >>

Nested Transaction!
Posted by Arpan at 8/5/2005 10:39:07 PM
The following example is given in BOL under the topic 'Nested Transaction': ---------------------------------------- CREATE PROCEDURE TransProc @PriKey INT, @CharCol CHAR(3) AS BEGIN TRANSACTION InProc INSERT INTO TestTrans VALUES (@PriKey, @CharCol) INSERT INTO TestTrans VALUES (@PriKey + ...more >>

Transaction!
Posted by Arpan at 8/5/2005 6:50:08 PM
If I am not mistaken, a Transaction is similar to a batch which encompasses a group of SQL statements & queries. Suppose I want to populate a table with records & I want to do this using a stored procedure. This can be done simply by creating a stored procedure like this: --------------------...more >>

SP parameter length
Posted by Just D. at 8/5/2005 6:24:26 PM
All, Is there any limitation for the length of the SP Parameter like 8 Kbytes or whatever? I know that if I store Image as a binary array the limit is 2 Gigs, what about other types? Just D. ...more >>

Foreign Key Error?
Posted by Karolus at 8/5/2005 6:15:01 PM
I'm a newbie to SQL Server. I've created tables and am entering the following: alter table t_AssessmentData add constraint fk_AssessmentData_WritingSampleID_WritingSample foreign key (WritingSampleID) references t_WritingSample (WritingSampleID) go The message I get is as follows:...more >>

Run-time Error Vs. Compile Error!
Posted by Arpan at 8/5/2005 5:23:20 PM
How to understand whether an error is a run-time error or a compile error? Thanks, Arpan ...more >>

Troubles pulling binary data into VBScript
Posted by maximillianx at 8/5/2005 4:15:04 PM
I'm a normal resident of the vbscript/wsh/server scripting forums, as I'm more of a scripter, and don't know word one about SQL...so here I am - :) I'm attempting to query a MS WSUS database stored on our SQL server (SQL 2000) - one of the two fields I am querying is reporting back fine (the...more >>

Stored Procedures
Posted by tshad at 8/5/2005 4:13:39 PM
Is there a good program or method for documenting your Stored procedures similar to JavaDocs? I am trying to find a good way to keep up with our Documentation and make it easier for our developers to keep track of what we have available as well as how to call them (what parameters and types...more >>



Bigint vs int
Posted by tshad at 8/5/2005 4:01:49 PM
I had set up my tables using BigInts for my Surrogate keys (identity) to make sure I could never run out of numbers. I am thinking maybe that was overkill and my slow my system down (I know it takes up more space, but that is not really an issue). Are the Bigints going to cause me a proble...more >>

What happens if...
Posted by Mike Labosh at 8/5/2005 3:09:33 PM
A coworker has some huge adhoc update that ran for like 17 hours, gooped itself up and rolled back. The rollback has been in-progress all day long and has not completed, and now they want to reboot the server. I have been asked to find out what the results of that would be. Is it the conc...more >>

Parent and grand parent and great grand parent etc.
Posted by Sehboo at 8/5/2005 1:19:02 PM
Hi, I have a table with id, parent-id. I want to know how to write a stored procedure which returns the ids of parent, grand-parent, great-grand-parent etc. So, if the structure is like this id Parent-id Tree Control ASP.NET Controls ASP.NET Controls AS...more >>

Transaction Log Backups
Posted by jjbutera NO[at]SPAM hotmail.com at 8/5/2005 1:00:49 PM
Hello all, I'm a novice when it comes to administrating SQL Server. Basically, I want to create a manual script that sort of recreates what log shipping does. Could someone help get me started with a script that performs the following: Script to run at end of day: 1. Full backup of source...more >>

in vs. exists
Posted by Jeffrey K. Ericson at 8/5/2005 12:28:03 PM
What is the difference between in and exists performance wise? I have tuned(aatempted to tune) queries where a subselect was introduced with an in. I have replaced th in with an exists and found the performance and plan to be the same....more >>

ALTER COLUMN
Posted by TS at 8/5/2005 12:15:05 PM
I have an access database that I'm splitting its back-end to be located in SQL server. One column in one of the access tables was autonumber. For maitenance purposes, some of the rows in this column have been deleted. When I converted the back-end to SQL, this column is defined as INT and I ca...more >>

Transforming string Rows to Column - How the function works?
Posted by carlos.rodrigues NO[at]SPAM recall.com at 8/5/2005 12:07:40 PM
Hello, For example, if I have this information on the database. ID Sequence Description 1 1 aaaa 1 2 bbbb 1 3 cccc 2 1 eeee 2 2 ffff I need this result: ID Description 1 aaaa, bbbb, cccc 2 eeee, ffff I have a function that result this, but I have no idea how this funct...more >>

reverse only the text parts of the field
Posted by Sam at 8/5/2005 11:56:52 AM
i have to import addresses from an text file. the text is reversed but numbers are not reversed "abcd 12 def" comes as "dcba 12 fed" if i use the reverse function it reveses also the number and the it becomes "abcd 21 def" how i can reverse only the text parts of the field? thanks ...more >>

Merging duplicate data into one row
Posted by Chris Asaipillai at 8/5/2005 11:53:30 AM
I have a set of customer data which is duplicated. The reason is that each customer has differrent [Failure Code]s applying to them. So i want to merge the data, the only tricky thing is that i would like to combine the Failure Codes into one field! An example is as follows: Contract ...more >>

Text vs VarChar(8000)
Posted by tshad at 8/5/2005 11:42:16 AM
Other than unlimited characters for Text, is there a drawback to using one over the other? I have all my text boxes in asp.net page (that are multilines) set to varChar(8000). Most of the time, I don't care expect more than a few hundred characters, but it could be more and I don't want to...more >>

Arbitrary assignment in join
Posted by Jami Bradley at 8/5/2005 11:41:28 AM
Hi folks - I'm hoping that this is an issue that has a reasonably easy answer :-) I am migrating data that has some grouping, but I there is not a unque join to get a 1-1 match for my data. What I need to to simply pick any *one* row and put it in any *one* row in my destination table. Here...more >>

Connection to Paradox
Posted by Yunus's Group at 8/5/2005 11:21:03 AM
Hello, I am trying to connect to paradox database for the purpose of updating the record(s) in DTS ActiveX Script Task. I used the following connection string. But I get an error while connection. I have "UMTest.db" and "UMTest.px" files in the "C:\MYDBPath" in my local drive. Set objRs ...more >>

Extended Stored Procedure
Posted by ReTF at 8/5/2005 10:59:15 AM
Hi All, What is Extended Stored Procedure? Thanks ...more >>

SQL equivalent of MySQL SET Type
Posted by Andy Hayes at 8/5/2005 10:58:55 AM
Hi I am trying to convert a table structure from MySQL into MS SQL Server. One of the datatypes I need to find an equivalent for is SET. Does anyone know what the equivalent is in MS SQL if it exists ? Regards Andy ...more >>

convert
Posted by TS at 8/5/2005 10:53:01 AM
Hi, I need to change the format of a date column in one of the tables to reflect a date that looks like mm/dd/yyyy. I used the following syntax that I know it's wrong -it works in a select statement-: alter table tbl_Reservation convert(char(20),[from date],101) as [From Date] Is there any...more >>

update rows with set-based GUID values?
Posted by jason at 8/5/2005 10:01:02 AM
given a hypothetical table: create table sample ( oldid int identity not null, name varchar(50) not null, constraint pk1 primary key nonclustered (oldid), constraint ak1 unique nonclustered ) i want to add a guid column like so: alter table sample add column newid uniqueid...more >>

OPENXML
Posted by JMNUSS at 8/5/2005 9:47:40 AM
I have written an OPENXML proc (this is my first one, so be gentle).... alter PROCEDURE sp_Insert_billing_Openxml @strXML ntext AS DECLARE @iDoc int EXECUTE sp_xml_preparedocument @iDoc OUTPUT, @strXML INSERT INTO billing ( billing_date, billing_worksh...more >>

Continue INSERT after key violation?
Posted by len at 8/5/2005 9:39:04 AM
Hi there. I have a simple table with a UNIQUE constraint on one field. I wish to populate this table using a stored procedure that returns the equivalent results set like so: INSERT INTO MyTable EXECUTE p_GetMyResultsSet My stored proc returns unique, distinct results each time it's ...more >>

ISNULL Function doesn't work
Posted by Ross Culver at 8/5/2005 9:21:08 AM
I have a most peculiar problem. On one of my customer's SQL servers, the ISNULL function doesn't work. No matter what datatype, the ISNULL returns a blank value instead of the designated value. (ex. ISNULL(field1, 10.00) returns blank instead of 10.00 for an actual Null value). Has anyon...more >>

Find second character in a string
Posted by Christian Perthen at 8/5/2005 9:19:36 AM
Hi, I have a string such as .75.34.100. How do I find the position of the second comma from the right. I been trying to use PATINDEX DECLARE @string varchar(30) SET @string = '.75.34.100.' SELECT PATINDEX('%.', LEFT(@string, LEN(@string)-1)) but it gives me 0 any insight on this? ...more >>

Porfermance between temporary table and cursor
Posted by wdwedw at 8/5/2005 9:12:03 AM
What's the porfermance different between temporary table and cursor?...more >>

Combining two seperate tables into one
Posted by Marcin Zmyslowski at 8/5/2005 9:05:05 AM
Hello! I don`t know how to do some query. I have two tables which looks like it: First table: MRPC 200504 200505 200506 C01 1 2 3 C02 2 3 4 C03 3 3 2 Second table: MRPC 200504 200505 2000506 C01 20% 20% ...more >>

Data type of temporary table
Posted by wdwedw at 8/5/2005 9:01:41 AM
I create a temporary table like this: select legalname into #tempname from company How do I know what's the data type of legalname in #tempname?...more >>

NESTED TRANSACTIONS!
Posted by Arpan at 8/5/2005 8:42:12 AM
In case of nested transactions, will the @@TRANCOUNT value be always 0 if the entire transaction is rolled back at the very end? Thanks, Arpan ...more >>

More Than 1 ROLLBACK Statement!
Posted by Arpan at 8/5/2005 8:36:15 AM
Consider the following code snippet: -------------------------------------------- BEGIN TRANSACTION OuterTran /* Do Something..... */ BEGIN TRANSACTION InnerTran /* Do Something More..... */ ROLLBACK TRANSACTION InnerTran /* Do something More.....*/ ROLLBACK TRANSACTION OuterTran /*...more >>

Using 'GO' In Transaction!
Posted by Arpan at 8/5/2005 8:34:45 AM
BOL, under the title '@@TRANCOUNT (T-SQL)', says that -------------------------------------------- The BEGIN TRANSACTION statement increments @@TRANCOUNT by 1. -------------------------------------------- The following Transaction first creates a table with 3 columns wherein I want the 3rd ...more >>

sometimes you gotta laugh
Posted by Payson at 8/5/2005 7:12:50 AM
I was making some mods this morning and ran across the following fragment - the names have been changed to protect my job :) It's typical code. For some reason, it struck me funny. if exists( SELECT top 1 * FROM xxx where col1 = 1 ) DELETE FROM xxx where col1 = 1 INSERT INTO xxx SELECT ...more >>

Return test result as column value
Posted by danny.dion NO[at]SPAM gmail.com at 8/5/2005 7:12:14 AM
Hi all. I'm writing a stored procedure that has to include a special flag for each row. I need to do something like this : SELECT t_client.client_id, t_activity.activity_id, t_activity.activity_dttm, ??? IF t_activity.activity_id IN (subquery) THEN 1 ELSE 0 AS can_be_deleted ??? F...more >>

Insert, updates not woring until SQL server restart.
Posted by sam at 8/5/2005 7:02:02 AM
Hi all, I hope this is the right place to post my question/problem. I have this problem with SQL server. All of a sudden the insert, updates does not work on SQL server based application written in ASP. The select commands are returning fine, its only the inserts and updates. They dont app...more >>

Multi-column query (pairwise query)
Posted by j at 8/5/2005 6:31:02 AM
Hello, My SQL knowledge originates from the world of Oracle, so bare with me. In Oracle you are able to query a table and filter results based on 2 columns in the WHERE clause (called pairwise query). Ex: SELECT col1, col2, col3, col4 FROM tablename1 WHERE (col1, col2) in (select col1,...more >>

Conversion of procedure making crosstab to function
Posted by Rafal Ba at 8/5/2005 5:46:52 AM
Hello Everybody, I have the following problem. I found procedure alolowing me to create dynamic crosstab and it works fine, but I cannot save the results as a table. Is there any way to do this? Maybe someone is in possesion of function which works as below procedure? Or someone is able to cha...more >>

Display stored procedure results in a view
Posted by Craig HB at 8/5/2005 4:16:07 AM
If a stored procedure returns a table, is it possible to return that as a view. Something like this (although I know that this SQL doesn't work)... CREATE VIEW vw_Equipment AS EXEC proc_Equipment_List Thanks, Craig ...more >>

services up or down
Posted by Enric at 8/5/2005 4:12:03 AM
Dear fellows, I would like to know if using T-SQL or VB code is posible figure out when a specific service from a Sql Server is up or down (either of them). Is it affordable? For example, I've got a front-end app in vb which retrieves information of each sql server in a domain. using osq...more >>

Debug Stored Procedure
Posted by jsfromynr at 8/5/2005 3:32:49 AM
Hi All, I wish to debug the stored procedure in SQL Server, but I am not able to do so. Is there any sort of Configuration required on the Server Side? When I try to debug the procedure it shows a warning that "When SQL Service is started using Local Account debugging can not be performed...more >>

How to call a Store proc inside a view
Posted by Cynthia at 8/5/2005 3:31:09 AM
Can anyone tell me how to call a sp inside a view. ...more >>

help with this
Posted by Chris at 8/5/2005 2:51:17 AM
Hi, I have a mail queue system in sql server that dispatches mail based on data in the queue table but now I want to group the mails so that instead of sending individual mails every 5 mins it will wait until the end of the day and then send off. The problem I have is grouping them. If I have...more >>

HowTo DECLARE CURSOR with parameters
Posted by Ottoman at 8/5/2005 2:40:24 AM
Hi All, i would like to nest 2 cursors and I would like to include in the declaration of the inner cursor a value which was fetched by the outer cursor. (i.e. a thing similar to correlated queries) So my question is: Is it possible to include a variable (@var) in the declaration of the inne...more >>

Internal SQL Server Error on a query that used to work
Posted by J. M. De Moor at 8/5/2005 2:03:26 AM
In porting an application from MSSQL 7.0 to MSSQL 2000 SP4, the following no longer works. CREATE TABLE Patients ( patient_id INT NOT NULL PRIMARY KEY ,activity CHAR(1) NOT NULL CHECK (activity IN ('M', 'N', 'P', 'I', 'A')) DEFAULT 'P' ); CREATE TABLE Incidents ( inc_nbr IN...more >>

Left Outer Join Problem not returning required result
Posted by Ghulam Farid at 8/5/2005 1:12:54 AM
Hi all i have two tables Daily_Report_Station and Main_yesno, in first table we r collecting daily reports and other table is for reporting day. in daily_report Station_tables i have list of centers which send us daily report. i m using the following query for the data to return on a specific...more >>

Stored Procedures Disappear
Posted by Carl Tribble at 8/5/2005 12:21:11 AM
I have a SQL Server 2000 database I built and am using .NET windows client and the .NET SQLClient object to access it. I have done a fair amount of work with it successfully including exeucting many stored procedures without any problem. There is one stored procedure however that seems to di...more >>

SQL statement question
Posted by Ricky L via SQLMonster.com at 8/5/2005 12:00:00 AM
Hi All, I have a questoin of writing SQL statement. Sample data A/C Code, Stock Code, Qty On hand, Unit Price AC00001 S00001 5 100.00 AC00001 S00002 4 110.00 AC00001 S00003 ...more >>

large updatestatement
Posted by Jason at 8/5/2005 12:00:00 AM
Hi, Is there a way to update a table without specifying the columns to be updated? I have a backup of the table which i join on a id. All columns are the same, but there are more than 100. So if i can create a statement like you can for an insert, it would be great. The backup table r...more >>

ADODB Streams
Posted by Brian at 8/5/2005 12:00:00 AM
Does anyone have an example of how to use an ADODB Stream object in a Stored Procedure to retrieve an image column. ...more >>

Should I COUNT or use TOP?
Posted by C-W at 8/5/2005 12:00:00 AM
I need to determine whether a row exists zero, one or more than one time in a table. At the moment I am doing... SELECT @PostCodeCount = COUNT(PostCode) FROM [dbo].[Clients] WHERE PostCode = @PostCode AND ClientSerialNo <> @ClientSerialNo My code will then do something different based on ...more >>

Doubt on unique non clustered Index
Posted by Pradeep Kutty at 8/5/2005 12:00:00 AM
Hi All, I have a table with data: CREATE TABLE [dbo].[Relation] ( [ID] [uniqueid] IDENTITY (1, 1) NOT NULL , [PersonID] [uniqueid] NOT NULL , [CurrentID] [uniqueid] NOT NULL , [RelativeName] [varchar] (50) NOT NULL , ) Here there are duplicate records for a combination of PersonID,...more >>

soundex + phonetic encoder
Posted by tw at 8/5/2005 12:00:00 AM
Hi, In SQL Server is the languague for soundex english. Is that possible to change the languague, for example swedish? Help. Thnx TW ...more >>

Problem with totaling
Posted by Kenneth at 8/5/2005 12:00:00 AM
I have a [transaction] table which stores [account no], [date], [amount] with lots of transactions (say, 300,000 records). Old transactions will be modified and new transactions will be added from time to time. Assume my program needs the amount sub-totals of different [account no] and diff...more >>


DevelopmentNow Blog