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 > november 2005 > threads for tuesday november 29

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

Stored Procedure will only update one row
Posted by dmartinm at 11/29/2005 9:56:19 PM
I am trying to create a stored procedure in SQL Server 2000 that updates multiple rows in a database table. I have two web pages. On the first page I use a form to submit multiple rows of data to a database table. On the second page I receive that form data and excute a stored procedure. It wo...more >>


hi
Posted by Lara at 11/29/2005 9:51:22 PM
Hi, I have a StudentMark table (StudentID int , SubjectID int, Mark int, Semester tinyint) The pass criteria for each student is given as follow 1. He should pass in all the 6 subjects (pass mark = 40) 2. Condition 1 + 1. Avg of any 4 subjects is 40% + Avg any 3 70% or 2. Avg of ...more >>

Query help
Posted by Lara at 11/29/2005 9:33:46 PM
Hi, I have an employee table having fields empid and managerid. I need a query which returns all the children once the parentid is given. Here is the script create table employee (empid int , parentID int ) GO insert into employee select 1,null insert into employee select 2,1 insert into...more >>

GROUP BY and ORDER BY
Posted by sharma.vasudev NO[at]SPAM gmail.com at 11/29/2005 9:04:08 PM
hi Guys! I am having a table customer { Name varchar(255), step int, details varchar(255) } I am trying to get the list of customer name with GROUP BY, and order it using ORDER BY SELECT Name FROM customer GROUP BY Name ORDER BY step but cause of ORDER BY clause it fa...more >>

mapping two references from one table ??
Posted by oracle at 11/29/2005 6:11:07 PM
Hi, I'm new to SQL programming and SQL 2000 server. My problem is that I have a table that contains antenna information. (Their can be different types of antenna's) I have another table that points to the antenna table twice, because it needs two different types of antennas. IE: GPS and ra...more >>

Where Claause for Unique Constraint?
Posted by xenophon at 11/29/2005 4:35:35 PM
Is it possible to create a constraint where the uniqueness is defined by 3 columns (2 VarChar, 1 Int), with the Int column having a value of 0? Thanks. ...more >>

Rows not being excluded by join
Posted by Harlan Messinger at 11/29/2005 4:15:55 PM
I've moved on from my earlier question on "max rows", having figured out an approach, but it's not doing what I expect. Below is my table definition. CREATE TABLE [dbo].[Recycles] ( [recycleID] [int] IDENTITY (1, 1) NOT NULL , [origEndOffice] [char] (11) COLLATE SQL_Latin1_General_CP1_CI_AS...more >>

identity in the resultset
Posted by prefect at 11/29/2005 3:49:59 PM
i want to generate a column in the resultset that works like an identity column. one way i thought is creating a temp table with an identity column and inserting resultset to that table and select again. is there any other way that works serverside? thanks... ...more >>



export data to .xls from stored procedure
Posted by mati at 11/29/2005 3:40:20 PM
Hi I was told to write an "application" that sends emails with some data stored in database to our company's departments. I'm trying to do this using stored procedures and DTS. Problem is that every file must have differrent name (depertment's ID is a part of it). So, I considered doing...more >>

Client Side Connectivity to SQL Server 2005
Posted by FrustratedXOracleBod at 11/29/2005 3:33:10 PM
Hello All I am an Oracle DBA currently learning SQL Server. I have downloaded SQL Server Express 2005 and installed it including Northwind and pubs databases. This worked just fine. Got the Server Management Studio Express CTP and installed it and that too works just fine - on the same machin...more >>

SQL....two phase commit protocol
Posted by D L Barnard at 11/29/2005 2:29:14 PM
how do i rewrite the following using the two-phase protocol and produce a schedule that is serializable? Transaction T22 sum:=0 Read(A) sum:=sum+A Read(B) sum:=sum+B Show(sum) Transaction T23 sum:=0 Read(A) A:=A-100 Write(A) sum:=sum+A Read(B) B:=B+100 Write(B) sum:=Sum+B Sho...more >>

Conversion from Access to SQL Server
Posted by fniles at 11/29/2005 2:21:47 PM
If the Access field is a "Yes/No" field, in Sql Server to what Data Type should I convert it to ? Thanks. ...more >>

SQL...backward error recovery technique
Posted by D L Barnard at 11/29/2005 2:13:01 PM
show me how the backward error recovery technique is applied to a DBMS that uses the update-in-place scheme to recover from a system crash with minimum loss of processing? thank u....more >>

SQL...nested transactions
Posted by D L Barnard at 11/29/2005 2:01:08 PM
what modifications have to b made to a recovery scheme if the transactions are nested? thank you....more >>

output param in stored proc is NULL
Posted by arzewski NO[at]SPAM hotmail.com at 11/29/2005 1:48:47 PM
if I invoke this stored proc and bind the output param @ReturnState to a VisualBasic app, I get the newly generated identity value. But running the script on the bottom, the @result variable is NULL. What am I missing ? --- create table Test111 ( scode int IDENTITY NOT NULL, sdesc varc...more >>

SQL Agent Jobs
Posted by RM at 11/29/2005 1:43:46 PM
Is there a way for me to programmatically create a job that can be run by SQL Agent ? What I need to is to programmatically do what one would using Enterprise Manager to create a SQL Agent job. Thanks, RM. ...more >>

Bizarre SQL statement
Posted by David Jessee at 11/29/2005 12:57:02 PM
I have a SQL UNION (I know I know....they're bad, but trust me, I have to use it) in a stored proc. Effectively, it liiks like this: SELECT f1, f2, f3 FROM T1 UNION SELECT f1, f2, f3 FROM T2 note: T1 and T2 are not tables, but parameterized query expressions that contain 3 and 4 t...more >>

Changing ownership on all objects in a DB
Posted by dotnettester at 11/29/2005 12:26:02 PM
Hi, I have to change ownership of all the tables/storedprocedures/views in a database. Can some tell me a good and easy way to do it. Thnx in advance....more >>

Reality check...
Posted by Mike Labosh at 11/29/2005 12:23:04 PM
Why the "top 100 percent"? Or am I just retarded? CREATE VIEW dbo.SmdsProductList AS SELECT TOP 100 PERCENT {whole bunch of columns and expressions} FROM {whole bunch of joins} WHERE ThisColumn = 1 AND ThatColumn IS NOT NULL ORDER BY SomeOtherThing -- Peace & happy co...more >>

SQL Server Developer Position
Posted by nyoung at 11/29/2005 12:23:04 PM
I am looking for a great SQL Server Developer position in the Charlotte area and I am looking for any good leads for where to look for qualified candidates. I would greatly appreciate any help that anyone could offer but I thought his would be the best place to ask for help. Thank you very muc...more >>

"Max row" in each group
Posted by Harlan Messinger at 11/29/2005 12:12:08 PM
I'm having trouble developing a query that will group on a given set of columns and, for each group, will also display the other columns in the "max row" for that group. Let me illustrate what I mean: CREATE TABLE [dbo].[GroupTest] ( [testID] [int] IDENTITY (1, 1) NOT NULL , [office] [cha...more >>

Referencing a composite foreign key
Posted by dwj at 11/29/2005 12:10:56 PM
I can't find any examples on how to do the below. Can anyone advise? I have an 'Address' table which has a primary key constructed from 'postcode' and 'house no'. I have numerous other tables that reference this table with a foreign key - how do I reference a composite foreign key such as t...more >>

help with query
Posted by Yaniv at 11/29/2005 12:04:45 PM
Hi, need some help... The problem I face is that the last column in the select list which is [Amount2] returns the sum of all users sum so each row in the returned result has the same number. The [Amount1] column returns the correct sum per each user due to the grouping. How shall I do...more >>

question about system tables
Posted by Kevin at 11/29/2005 11:57:09 AM
hi guys, a few questions regarding system table on sql 2000. I think I need to rebuild indexes for msdb..sysdtspackages table. after I do indexdefrag, the density is still 52%. So i'm thinking to do "CREATE INDEX ... WITH DROP_EXISTING" on it, but I can't generate index script fr...more >>

Query Notification question
Posted by ChrisAtPhaseWare at 11/29/2005 11:46:23 AM
I am having issues getting a SqlDependency proof of concept app to work. I took a step back and performed the MSDN lab titled SQL Server and ADO.NET (LabB), located here: http://msdn.microsoft.com/vstudio/tryit/hosted/sql/default.aspx. It contains an example using SqlDependency to monitor ...more >>

isql file wrapping
Posted by Matt Benvenuti at 11/29/2005 11:41:19 AM
Hi all! I'm trying to create a text file of data from a MS-SQL table. I'm using the utility at the end of this post. The problem I'm having is the output file is wrapping text after 80 chars (I think). I need the record written on one line completely. Finding ISQL tutorial help on the we...more >>

T-SQL to denormalize data
Posted by Dave at 11/29/2005 11:29:25 AM
Guys I am trying to demoralize the source column in one of my tables so I can identify the combination of sources that the email was recruited from. I know I can do this with a cursor but I would really prefer taking a set based approach. My data table looks something like #data_table and I...more >>

Shared procedure with variable field name + data pairs
Posted by Laurence Bush at 11/29/2005 11:00:05 AM
I wrote a program that uses embedded SQL to make rows in a table with more than 100 fields. Each row type only uses a few fields, the rest are blank. I used the form "insert ... (fieldname1, fieldname12, fieldname44) values (val1, val12, val44)", with different numbers of values each time de...more >>

Blocking Threshold Exceeded
Posted by Jason at 11/29/2005 10:48:16 AM
I have a site that calls a stored procedure to populate data on an ASP page. 50% of the time when I access this page I get a timeout error. I looked in the Event Viewer and noticed MSSQLSERVER errors with this description: Error: 50001, Severity: 16, State: 1 Blocking Threshold Exceeded, ...more >>

xml store data on sql
Posted by JFB at 11/29/2005 10:39:11 AM
Hi All, Well... I got the xml file to work with OpenXML, but as you see on my xml file I have different structure for all data and I want to get part of it but store in one row on my table. Here is sample of xml structure <?xml version=""1.0""?> <FieldTitle1> <Request> <Reference...more >>

INSERT many records with one statement
Posted by Chris at 11/29/2005 10:18:53 AM
I'm trying to insert xx identical records with 1 statement. Basically, I want to avoid the following if I know I want to insert 6 records: INSERT INTO myTable(Field1,Field1) VALUES(1,2); INSERT INTO myTable(Field1,Field1) VALUES(1,2); INSERT INTO myTable(Field1,Field1) VALUES(1,2); INSERT I...more >>

SELECT DISTINCT help
Posted by Milt at 11/29/2005 10:11:42 AM
Hello, I need to extract some data from an un-normalized database. The structure is basically: ID, Address, City, State, Zip. I want the distinct (address, city, state, zip) combos with one and only one ID (doesn't matter which one). Sample table values: 1, 123 Main St, Anywhere, IL, 666...more >>

Article on when to use Stored Procs?
Posted by Dave L at 11/29/2005 9:16:10 AM
Does anybody know of some good articles or whitepapers on when to use stored procs and when not to use them? Thanks in advance. Dave ...more >>

Duration, not time...?
Posted by zamdrist NO[at]SPAM gmail.com at 11/29/2005 9:00:34 AM
How could I store a value given to me as a string as a duration of minutes, seconds? As opposed to a datetime? Say I'm given the string...00:04:08 But I don't want to, if it can be helped, store as: 1/1/1900 00:04:08 Make sense? I want to store as a duration of time, not an actual time......more >>

Just "effing" wonderful.
Posted by Mike Labosh at 11/29/2005 8:58:09 AM
Here's a table that's PK'd on "SurveyKey" and "ProductKey" Both columns are NULL. From top to bottom. Some developer [not me] must have done this. Just makes you wanna say, "GRBNF!!!!" -- Peace & happy computing, Mike Labosh, MCSD "When you kill a man, you're a murderer. Kill...more >>

Count(*) divide returning 0?
Posted by Chris Ashley at 11/29/2005 8:38:37 AM
I'm using this query: select count(*) / 25793 * 100 thecount, promocode from [December-Fixed2005v2] GROUP BY PromoCode order by thecount 'TheCount' comes back as all 0's which isn't right as without the divide/multiply bit it comes back with 45, 127 etc. How can I fix this? Do I need to cas...more >>

joining a varchar with a int column
Posted by arzewski NO[at]SPAM hotmail.com at 11/29/2005 8:23:59 AM
just noticed this, wonder if there is a performance hit got results when executing the following select AgendaID from ObjectiveAgenda Inner Join Objective On Objective.ObjectiveID = ObjectiveAgenda.ObjectiveID problem is that the ObjectiveID column in one table is of SQL type INTEGER, w...more >>

table partitioning
Posted by bubix at 11/29/2005 8:07:09 AM
Hello, Can we do table partitioning with SQL Server 2005 Express?? I post this question, because I saw in features comparisons tables for each edition, that was only possible with Entreprise edition.. at this url: http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx T...more >>

How to run multiple jobs in parallel
Posted by Mark at 11/29/2005 7:36:11 AM
I have five SQL jobs that I want to run at the same time to save time. Running them in serialization costs me lot of time so running in parallel is choice I have. However, they all need to run after 5 DBs are restored. So, I created one job that does all the restore for these 5 DBs one after a...more >>

Syntax error
Posted by Dazed&Confused at 11/29/2005 6:40:19 AM
Just learning SQL from a "learn in a weekend" book. Working on Stored Procedures. Wrote procedure exactly as in book to "Add New Customers". That went well BUT when I put in the EXECUTE part after-calling on the stored procedure, all the data requires " (Quotes) instead of ' around them or el...more >>

ERROR: Must declare the scalar variable (@Date_ID)
Posted by Terry at 11/29/2005 5:01:12 AM
How should I resolve the following error message? Thank you. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.D...more >>

SPLIT to INSERT
Posted by rudolf.ball NO[at]SPAM asfinag.at at 11/29/2005 4:07:52 AM
Hi NG, I have a question about a query like this: I have a table X with an ID and a varchar-value like this: ID | myString 1 -12-33-177-44- 2 - 76-12-6-888-34- 3 - 19-34-65-111-9-212- As you see, the myString value is a set of INT values, divided by a "-". What I...more >>

Change condition if the first doesn't exists
Posted by Senna at 11/29/2005 4:07:02 AM
Have two tables: [CODE] CREATE TABLE [Table1] ( [Id] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL , [Number] [varchar] (50) NOT NULL , [TimeStamp] [smalldatetime] NOT NULL CONSTRAINT [DF_Table1_TimeStamp] DEFAULT (getdate()), CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTER...more >>

Improving performance of GROUP BY query
Posted by richhollis NO[at]SPAM gmail.com at 11/29/2005 3:59:43 AM
Hi I'm trying to improve performance of this query: select fk_serverid, count( distinct fk_metricid ) from sdb_metrics SDBM inner join LU_SERVER LUS on LUS.pk_serverid = SDBM.fk_serverid inner join LU_SERVERNAME LUSN on LUSN.pk_servernameid = LUS.fk_servernameid group by fk_serverid ...more >>

JOIN Query Problem
Posted by kenny.vaes NO[at]SPAM gmail.com at 11/29/2005 3:19:11 AM
Hi, I'm not that experienced with this so I need some help :) I've got 2 tables a Header and a Line table Now I want to select all headers but I want to filter out those that have lines with the Status Finished So I came up with this query: SELECT * FROM Header LEFT JOIN Line ON (Head...more >>

simple query
Posted by vanitha at 11/29/2005 3:11:04 AM
hi friends, my table structure is create table sample1(ref_no varchar(50),Date1 varchar(10),time1 varchar(10)) records are like insert into sample1 values('sdfsdf','12/12/2004','03:02:02') insert into sample1 values('sdfsdf','12/12/2004','02:02:02') now i want to retrieve the latest ...more >>

BULK INSERT with leading/trailing quotes
Posted by Jesper Stocholm at 11/29/2005 2:51:02 AM
I am using BULK INSERT to load data from some CSV-file into SQL-server 7.0. The files use TAB to seperate fields and NEWLINE to seperate rows. However - we would like to be able to have these characters in the fields themselves, e.g. a TAB or NEWLINE in a field which contain free-text from ...more >>

Get files from FTP using DTS
Posted by fuhlendorf NO[at]SPAM hotmail.com at 11/29/2005 12:12:45 AM
Hi, I seem to face a problem getting the right files from an FTP-server. I do need to logon to the ftp site, go into a sub-directory and transfer the files in that directory. However the transfer is always carried out one the main directory eventhough I have explicit defined that it is the ...more >>

now() and datetime: out-of-range
Posted by Dennis at 11/29/2005 12:00:00 AM
Hi Everyone, I've read a lot about a problem I'm experiencing but I'm still very confused. I have a winxp vbscript that inserts username, machine name, ip address and current date into an SQL table. The code is: strSQL = "INSERT INTO users VALUES ('" & strUserName & "', '" &strComputerNa...more >>

How Can I Do This
Posted by Taha at 11/29/2005 12:00:00 AM
Select Num,dbo.Total(Num) As Total_Salary ,dbo.Tax(Total_Salary) From Test Total is Function to Calculate Base Salary + Some in come Tax is Function To Calculate Tax From Function Total plz Help Me ...more >>

How can I get the files under a special directory on a remote sql server?
Posted by Bill White at 11/29/2005 12:00:00 AM
we can get directory information by EnumDirectories method of sql server object from a remote sql server, but how can I get the files under a special directory on a remote sql server? I tried finding result in MSDN, but I can't get it. Any one can help me? Thanks in advance. Bill White ...more >>

Timestamp Alter Table
Posted by Immy at 11/29/2005 12:00:00 AM
Hi all, I have a script that will ALTER TABLE and ADD a Timestamp column to all tables in the database. In SQL2000 this works fine. The column does not all nulls and by default, SQL2000 add the current timestamp record. Now - In SQL 6.5.... YES!, I said SQL 6.5 :) - this behaviour doesn't...more >>

using login name as variable in grant statement
Posted by Vikram at 11/29/2005 12:00:00 AM
i want to make a procedure which accept loginname and will use this paramtere to grant execess to some objects like: GRANT EXEC ON sp_OACreate TO @BMS_DEV @BMS_DEV will be parameter passed to the sp... how ca i do this ...more >>


DevelopmentNow Blog