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 > february 2004

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

Select next value from a group
Posted by Bent Lund at 2/29/2004 10:29:05 PM
Hello, I have a problem getting the value I want here ;-) I have a view looking like this: ITEM_SEQ_NO int unique ID for item CAST_ID varchar(20) Batch ID for n ITEM's STEP_NO int step in production 1-20 STEP_ORDER_NO int order of item within step Data could look like this Ite...more >>


Convert to datatype money
Posted by Aleks at 2/29/2004 10:27:57 PM
Hi, This might be an easy one, just cant find how to code it. I have 2 variables which I want to add (strBalance and strLink) the values could be: 500+300 = 800. The problem is that my code is instead adding them like this: 500+300 = 500,300 Below is the code. ------------------------...more >>

Help with vars.
Posted by Aleks at 2/29/2004 10:26:35 PM
Hi, This might be an easy one, just cant find how to code it. I have 2 variables which I want to add (strBalance and strLink) the values could be: 500+300 = 800. The problem is that my code is instead adding them like this: 500+300 = 500,300 Below is the code. ------------------------...more >>

dynamic numbering of results
Posted by Jarrad at 2/29/2004 10:01:08 PM
am trying to get an sql query that will auto number rankings for me The problem is as follows Through a number of queries I can load a temporay table with data e. Site_ID,Total_Sales,Sales_Dept,Sales_Chip I need to end up with Site_ID,Total_Sales,Ranking_TotalSales,Sales_Dept,Ranking_Sales_De...more >>

IDENTITY Problem
Posted by Anand at 2/29/2004 9:59:28 PM
Hi all If the IDENTITY Column exceeds the limit is it possible to reset automatically. It should be done automatically at the table level. Any answer?? Thanks in advance Anand. ...more >>

How to ensure that client connects to server throug the internet instead of LAN
Posted by Oscar at 2/29/2004 9:54:31 PM
I am programming a VB-SQL Server 2K application which connects the clients to the database through the internet. While I am testing the application within a LAN in which the database server as well as the client connect to the internet through a router I can't ensure that the client connects to t...more >>

Help. I broke an Stored Procedure
Posted by is4fun2k NO[at]SPAM yahoo.com at 2/29/2004 7:54:07 PM
Hello, I just realized I made a BIG Mistake. I was working "Creating/Updating" several stored procedures. I ran an Alter on a stored procedure thinking it was another stored procedure. So I changed it completely. Is there a way I can recover the previous stored procedure code? If it helps t...more >>

stored procedures
Posted by anna at 2/29/2004 7:36:10 PM
I am trying to execute the foloowing as a stored procedure, however I keep receiving error messages indicating that the temp tables do not exist... Is this someting inherent in SQL Server sp' USE ATReportin G IF EXISTS (SELECT name FROM sysobjects WHERE name = N'usp_insertBillable...more >>



Convert to DateTime
Posted by Elmo Watson at 2/29/2004 7:01:33 PM
Unfortunately, I've inherited a database with a field which has been adding dates and times, but it's been using an nvarchar field . Most of the strings are in this format: Mon Oct 13 12:58:00 2003 EST but of course, there are still strings that will convert to date and time more easily li...more >>

Any help with tihs would be great....
Posted by Darren Clark at 2/29/2004 4:22:21 PM
I have the following table.... it stores points ,, as in currency type points.. or credits.. whatever you want to call it. CREATE TABLE [Points] ( [points_id] [numeric](18, 0) IDENTITY (1, 1) NOT NULL , [type_id] [numeric](18, 0) NOT NULL , [action_id] [numeric](18, 0) NULL , [mem_id] [...more >>

performance consideration
Posted by Guy Brom at 2/29/2004 4:10:57 PM
Hello, I have a 1 million user db, where only a fraction (about 20,000) actually logged on daily. Every user is authonticated on each to a session value he received upon logging-on. users are logged out if they have invalid session value (hack attempt) and/or passed N number of minutes sinc...more >>

disappearing foreign key constraints
Posted by vickihann NO[at]SPAM abcsoftware.co.nz at 2/29/2004 3:14:32 PM
We are using sql server 2000 and have found that some of our constaints between tables are no longer there. This has happened a few times over the past few months with different tables. Any ideas as to why this might be happening?...more >>

Run-time error 2191 - inconsistantly appearing
Posted by vickihann NO[at]SPAM abcsoftware.co.nz at 2/29/2004 3:10:42 PM
We have a report that has successfully been previewed with the change of record source code. After changing the SELECT statement in the record source this error appears. Please help....more >>

Very Simple Stored Proc with parameter problem when called from simple .net app
Posted by lanpheer NO[at]SPAM hotmail.com at 2/29/2004 1:22:14 PM
I'm a bit embarassed to have this problem, but nonetheless, I've tried all I can think of. I can't seem to call a stored proc from a .net app that has a parameter. Stored procs with no params work fine, AND calling the stored proc from SQL Query Analyzer works fine. I'm sure there is somethin...more >>

architecture problem
Posted by (doubtfulinfo NO[at]SPAM yahoo.com) at 2/29/2004 1:10:17 PM
first of all i am a student, so i want you to be a little mercy, because this is soo important to me ! second i got a real project that archieves the materials of a club in my univercity.. it will store the related information of photographs, CDs, cassettes, etc.. in one computer( that should be t...more >>

i am in a serious trouble...
Posted by (doubtfulinfo NO[at]SPAM yahoo.com) at 2/29/2004 1:07:10 PM
first of all i am a student, so i want you to be a little mercy, because this is soo important to me ! second i got a real project that archieves the materials of a club in my univercity.. it will store the related information of photographs, CDs, cassettes, etc.. in one computer( that should be t...more >>

CountrySelector control
Posted by versteijn NO[at]SPAM 538mail.nl at 2/29/2004 9:36:21 AM
Hello all I am developing a CountrySelector control (which I would like to share with anyone), but I am quite a newby in this custom control area. You can find it at: http://home.kabelfoon.nl/~juliusd/vbnet/CountrySelector.vb Some questions I have are: - In what event should the items be...more >>

Merge Similar rows - Help needed
Posted by CoolHandSid at 2/29/2004 6:51:06 AM
Hi I'm trying to a merge similar rows in a table into a single row and put the in a new table Example: This is my input tabl Table ID A B ----------------------- 1 jk kl b 2 sd we o 3 io po k 1 ui gh e 2 kl re o 1 qw kj n My output table should look like thi Table ID A1 B...more >>

RAISERROR descriptions
Posted by Ivar Svendsen at 2/29/2004 6:41:07 AM
Hello I am connecting Access 2002 to a Microsoft SQL 2000 server. When I try to run a stored procedure that returns errors, I can only read the error codes, and not the description of the error. Here is some example code that I am using CREATE PROCEDURE dbo.Tes A BEGI RAISERROR ( 'Test', 16,...more >>

Selecting Nulls
Posted by James Proctor at 2/29/2004 2:26:06 AM
Hi, I need to select all the Null values in a coloumn but cant work out how to, ive tried all sorts such as SELECT * FROM Kits WHERE KitExpiryDate = NULL and lots of other combinations but it doesnt seem to work. Is there a special way to select NULL values. I hope someone can help me out Regard ...more >>

Union Query Problems
Posted by John Berman at 2/29/2004 1:40:26 AM
Hi I have two querys that work fine so I joined them with a Union and I get The text, ntext, or image data type cannot be selected as DISTINCT. So I used union all and now get All queries in an SQL statement containing a UNION operator must have an equal number of expressions in their t...more >>

SQL serverdown...OLEDB-SQL driver timeout?
Posted by Anonymous at 2/29/2004 12:22:15 AM
I am using OLEDB-SQL (ADO) under MDAC 2.7 and would like to know if there is any way to change the timeout period the driver takes to search for the SQL server before returning an error. Of most importance to me is a short timeout period, I.e. an error is returned quickly if the SQL server is dow...more >>

Invalid attempt to read when no data is present...NOT true
Posted by Trint Smith at 2/28/2004 10:48:52 PM
I keep getting this with this. First, heres my sql string: SELECT item_itemcurrentbidprice, item_itemcurrentorpurchasedbidder FROM TBL_Items WHERE item_itemnumber = 'b4e81177-35dd-44d7-b996-8e285103f11a' Here's the code: error happens at 'ToString' at the bottom. Dim itemNumberSold As String ...more >>

Print data directly from a stored procedure?
Posted by Sandro at 2/28/2004 9:41:06 PM
Is it possible to print data using an SQL statement or stored procedure Any suggestions would be welcom Thank Sandro...more >>

Specifying criteria as join condition vs WHERE clause
Posted by David F at 2/28/2004 8:48:19 PM
Does it matter whether a condition is specified as part of a JOIN or in the WHERE clause? In other words, this.. SELECT * FROM orders o JOIN orderdetail od ON o.ordid=od.ordid AND datediff (dd, o.orddate, od.orddate)=0 returns the same as this... SELECT * FROM orders o JOIN orde...more >>

char output params : blanks return as nulls ?
Posted by John A Grandy at 2/28/2004 4:36:39 PM
i am finding that for stored procedure output parameters of type char, blank values are returned as nulls .... which is not what i expected ... CREATE PROCEDURE dbo.usp_GetMaxLocationNumber ( @Prefix char(3), @MaxLocationNumber char(7) OUTPUT ) AS SET NOCOUNT ON SELECT @MaxLocationNumbe...more >>

find out query history
Posted by hmc at 2/28/2004 4:29:05 PM
Hi, How can I find out what's the exact queries executed on a given database Thanks...more >>

How can I return a TEXT data type Value ( >8000) from a stored proc?
Posted by Steven Xu at 2/28/2004 2:19:22 PM
Hi all, Is it possiable return a text data type form a SP? create proc test @test_text text output as Select test_text from Table 1 Thanks for your time Steve ...more >>

Create Procedure must be the first statement
Posted by Abhishek Srivastava at 2/28/2004 12:35:30 PM
Hello All, Why should the Create Procedure be the first line of every batch? I don't understand the reason behind this requirement. Thanks for your help. regards, Abhishek....more >>

SQL view
Posted by smk2 at 2/28/2004 12:26:04 PM
Newbie question: I have a client table (ClientID), clientPhone table (ClientID, PhoneID), and Phone table (PhoneID) I made a view linking the clientPhone table to the phone table, but can't add any new records! PhoneID in the phone table is an identity column What I need is a table with ClientID...more >>

What is wrong with this code please?
Posted by Trint Smith at 2/28/2004 11:38:52 AM
strSQL = "UPDATE [tribidz].[dbo].[TBL_Items] SET" & _ " item_itemsoldprice = " & PrepareStr(PutPriceAsSold) & _ "FROM TBL_Items " & _ "WHERE item_itemnumber = '" & fstQuery & "'" This is the error message: Incorrect syntax near 'TBL_Items...more >>

Varchar Truncated
Posted by Carlos Lee at 2/28/2004 10:31:36 AM
I have a Stored Procedure where I'm using an Varchar(500) variable. But when I store more than 255 characters and then I read it, It got truncated... I want to know why if that kind of data suppose to store up to 8000 bytes. Thanks in advance Carlos Lee ...more >>

select xml value from stored xml column
Posted by italianomila2 NO[at]SPAM yahoo.com at 2/28/2004 10:19:35 AM
I have a column in a table that stores XML of an order...call the column "order_xml." The xml looks like this (simplified): <?xml version="1.0"?> <order> <total>100</total> </order> I want to select just the <total> value in a select statement for each order and then sum the results. ...more >>

'Shuffling' empty address columns
Posted by Adrian at 2/28/2004 10:13:21 AM
SQL Server 2000 I want to 'shuffle' address columns so that the first n columns always contain the address elements. For example: Add1: 1 Add2: High Street Add3: Add4: London Add5: W1 1AA becomes Add1: 1 Add2: High Street Add3: London Add4: W1 1AA Add5: or Add1: Add2: ...more >>

Column Alias in ORDER BY not work if in function call
Posted by ranman at 2/28/2004 10:11:04 AM
Why can't you put the column alias inside a function call in an ORDER BY clause (Using the Northwind database Example: The following query gives an error (Invalid column name 'title') select ContactTitle as title from Customer Order By LOWER(title whereas this doesn't select ContactTitl...more >>

Problem with select
Posted by Don Grover at 2/28/2004 8:24:36 AM
Firstly I am new at asking questions, so please excuse me if I supply too little or too much information, and explain if I need to supply more detail, Thanks. Ok I have 3 tables tblConnotes, tblProducts1 and tblOrderDetails. I am trying to include a tblConNotes.qtyRecieved as a SUM , the probl...more >>

Holidays in SQL Server
Posted by Nils Magnus Englund at 2/28/2004 3:56:35 AM
Hi! I have a large table in SQL Server 2000 with a datetime-column 'dt'. I want to select all rows from that table, excluding days which fall on holidays or weekends. What is the best way to accomplish this? I considered creating a new table called "holidays" and then selecting all rows (sort ...more >>

Storing and Retrieving URL's in SQL server database with ASP
Posted by Gunjakx at 2/28/2004 3:41:33 AM
Having small problem, i'm trying to retrieve hyperlinks from my Database with the use of ASP, its for a small project this i'm working on, i was woundering if anyone had any ideas of how to set up a column within a table that is used to store URL's. I also want to retrieve these URL's and ...more >>

Named Transactions
Posted by Amin Sobati at 2/28/2004 12:41:18 AM
Hi, I have problem with rolling back a named transaction: begin tran a insert Table1 values('test') rollback tran a I get this error: Cannot roll back a. No transaction or savepoint of that name was found. How can I rollback Transaction a? Any help would be greatly appreciated. Rega...more >>

Need to UPDATE while conditions change...
Posted by Trint Smith at 2/27/2004 10:19:04 PM
Ok, I need to start reading from the beginning of a table. 2 conditions: While reading, if an endingdate column is less than todays date and another columns value is "y" I need to copy data from one field to another. This must all be done from within vb.net. Any help is appreciated. Thanks, T...more >>

How do I deleting all but the last 3 records entered
Posted by SamIAm at 2/27/2004 9:08:25 PM
Hi I have a system where each member can only have 3 records in a table. When a new row is created for a member, I need to delete the oldest record first so that there are never more than 3 records for a member. How do I do this in TSQL? Thank, S ...more >>

Function error
Posted by Marvin at 2/27/2004 8:28:39 PM
Hiya, I have an error in this function It is supposed to remove any non-numeric characters. a value of 3v345 would come back as 3345. But why does it return a NULL if the first character is non-numeric? i.e. v3345 comes back NULL rather than 3345 thanks!! CREATE FUNCTION [dbo].[S...more >>

Query to display stored procedure?
Posted by Alexis M at 2/27/2004 6:40:39 PM
Is there a query I can run to display the contents/code of a certain stored procedure? Regards, Alex -- ...more >>

simulating oracle sequences in MS SQL?
Posted by michael johnson at 2/27/2004 6:16:18 PM
Hello All: I have been tasked to move a moderate sized application from oracle to sql server. Oracle has a sequence mechanism for generating unique numbers in sequence for record keys. Is there a mechanism like this for SQL SERVER? The identity column will not help me because i need the key a...more >>

Locking problem
Posted by Francisco D. Kurpiel at 2/27/2004 6:02:43 PM
Do I have a problem, a lock must occur and it isn't happening. Please, lets with the war against my marketing department ;). I have a problem with locking on sql server 2000 sp3. I select one record from a table using the primary key on the where clause, inside a transaction with serializabl...more >>

Getting the Date as string yymmddhhmmss
Posted by SamIAm at 2/27/2004 5:43:22 PM
I need to get the current date as a varchar in the following format yymmddhhmmss What's is the quickest way to do this? Thanks S ...more >>

HELP: String UP TO 255 characters
Posted by Carlos Lee at 2/27/2004 5:23:02 PM
I have a Stored Procedure where I need to concatenate in order to build a Query, but it gets soo long... Up to 255 bytes, so, I need to know how to store a string like these. I have tried to use TEXT and NText but I can not use them on Stored Procedures. Please help me Carlos Lee ...more >>

decimal rounding issue
Posted by ChrisB at 2/27/2004 5:13:34 PM
Hello: I am trying to store C# decimal datatype values in SQL Server and seem to be having some difficulty. For example, if I set a a C# variable to 11.75M and attempt to persist that value to a decimal database field with a precision of 19 and scale of 2, the value is stored as 12 instead ...more >>

advanced question - 'xlock' hint on record not locking select * from table
Posted by Francisco D. Kurpiel at 2/27/2004 4:50:16 PM
I have a problem with locking on sql server 2000 sp3. I select one record from a table using the primary key on the where clause, inside a transaction with serializable level. In another connection, I try to do a simple select * from sametable (also using serializable transaction level) and this ...more >>

Triggering After an update
Posted by Scott Elgram at 2/27/2004 4:48:34 PM
Hello, I am having problems with the following trigger; CREATE TRIGGER [tr_Test] ON [dbo].[Test] AFTER UPDATE AS EXEC master..xp_CmdShell "C:\DB-2.vbs" What I am hoping to achieve here is executing DB-2.vbs after an update to the Test table. Currently this throws back an "invalid syn...more >>


DevelopmentNow Blog