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 > may 2006

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

Debugging Stored Procedure
Posted by RKNET at 5/31/2006 9:11:01 PM
How to Debug the Stored procedure in SQL 2005. I thnk its thru VS, pls let me know the details or any references. Thanks -- RKNET...more >>

How to write this query?
Posted by VJ at 5/31/2006 8:43:28 PM
I've a Bill of Material table that looks some what like this: Table BOM: Part# Component# 1 A 1 B 1 C A X A Y B M B N B O B P B Q B R R ...more >>

Email Trigger
Posted by panda at 5/31/2006 8:02:02 PM
Hi. I am trying to set a trigger to send an email notification. is this possible in SQL 2000? What i am trying to do is send an email saying that a client has been here for 12 months and would like to raise the rent. Regards Wilbur...more >>

SQL2K & SQL2005, Can they coexist?
Posted by Jorge Luzarraga at 5/31/2006 7:35:00 PM
Hi, I wonder If I can have both SQL2K and SQL2005 installed on my windows XP box. TIA, Jorge Luzarraga C ...more >>

SQL Server 2005: client-connectivity changes?
Posted by KJ at 5/31/2006 4:52:32 PM
Hello Everyone, I would like to know if there are any major changes in client connectivity when connecting to SQL Server 2005 vs. SQL Server 2000. I know about a few of the new things, such as using Native Client, Shared Memory, and the Dedicated Admin connection. Are there other big change...more >>

using master..sysdatabase return an error message in MSSQL 2005
Posted by Jodie at 5/31/2006 4:38:01 PM
Hi All, I ran the following sql statement in the command line : osql /Usa /Psa /Sjpham-pc -l60 -Q"select version from master..sysdatabase where dbid=1" -o file and the error message return back is :Invalid object name 'master..sysdatabase'. It worked on MS...more >>

double vs decimal in high-frequency db
Posted by CP Developer at 5/31/2006 2:46:02 PM
I am storing financial data (stock prices, profit and loss figures, etc..) in a SQL 2005 database. The database will be updated with a high frequency. I am debating whether to use decimal or double/float to store these values and I am concerned that using decimal will slow down the database. S...more >>

Sql error not being caught within vb.net 2.0
Posted by hardingaj NO[at]SPAM ilga.gov at 5/31/2006 2:07:27 PM
Here is a sample Stored Procedure: Create PROCEDURE spSample AS SET NOCOUNT ON DECLARE @ErrorMsg varchar(8000) BEGIN TRY --the following error will be caught and returned to vb.net 2.0 --declare @var int --select @var = 1/0 --the following error will be caught but will not be retu...more >>



Sub-Query
Posted by Eric Stott at 5/31/2006 2:05:14 PM
I have a requirement that I need to extract person's data from multiple tables, along with checking to see if they are twins. The 'twin' logic is if they have the indicator of 02, 03, etc. as the dependancy code and they have the same sex and birthdate are the same. so my query looks somethin...more >>

Update multiple records - SQL
Posted by Keith Kubicek at 5/31/2006 2:04:23 PM
Thanks Dan, I alread tried = and got the same error. Where would I find an update trigger (on the Inventory table)? -- Keith Kubicek ------------------------------------------------------------------------ Posted via http://www.codecomments.com ----------------------------------------...more >>

transport-level error
Posted by none NO[at]SPAM no.com at 5/31/2006 1:53:02 PM
Hi, I'm accessing a pair of databases with ASP.NET 2.0 (ADO), and using stored procedures on the first database access. SQL server 2005 is local: Client and server are on the same box. The first access works OK - everything gets written to where it's supposed to be. On attempting to wr...more >>

Parameter Queries
Posted by MikeV06 at 5/31/2006 1:31:45 PM
If I understand what I am doing .... I can run an unnamed parameter query in Query Analyzer SELECT au_lname, au_fname FROM dbo.authors WHERE (state = ?) However, that is about all I can do with it. I have not been able to do anything with named parameter queries. I gu...more >>

Mobile 5.0 app can not connect to SQL 2005 Express
Posted by RedHair at 5/31/2006 12:18:21 PM
I'm using VS2005 pro to develop one windows form and one Mobile5.0 app , they are simple apps and just connect to SQL server to get data. The SQL servers include Win2K + SQL2K, Win2K3 + SQL2K5 std and Win2K3 + SQL2K5 Express. All works fine until one day I updated Win2K3 patches to the sql se...more >>

Rounding very small negative numbers to string
Posted by Alan Z. Scharf at 5/31/2006 12:16:36 PM
Hi, I'm trying to round a very small negative number, e.g. -.024, to a string. If I round -.024 to 1 place, I get 0.0 However, when converting to string, I get .-0 Is there some combination of functions to get rid of the minus sign in such a situation, or do I have to put in an IF condi...more >>

temp tables
Posted by Lianne Kwock at 5/31/2006 11:17:02 AM
Hello, I experienced extreme slowness on performance when I did multiple joins on global temporary tables, I checked the query analyzer plan and found out that multiple table scans were occuring. Does anyone know why the system behaves like that? The following is a sample of my query af...more >>

MOD Equivalent in SQl Server?
Posted by Greg Toronto at 5/31/2006 11:15:02 AM
I'm trying to build a query that I'd like only run on records with an odd number in a specific field. Using the "MOD" function, I'd simply throw a criteria in that says where "Field Mod 2 <> 0" Is there a mod function in SQL Server 2K? I can't find it... If not, what's my alternative? ...more >>

How can I implement error handling within a SQL script that uses b
Posted by Dave at 5/31/2006 10:36:02 AM
I am trying to incorporate error handling into a SQL script that creates several database objects. Those objects are referenced later in the script by other blocks of code. It is my understanding that I need to use a new batch to reference an object that was just created. I can do this by...more >>

Run Script from drive location
Posted by Jaco at 5/31/2006 9:36:01 AM
Hi, How can I run a script in a job and call it from a drive location? ie. the script file will be located on a network share. The script is more than 3200 chars so I cannot call it in the job step. Thanks....more >>

sp_executesql not working
Posted by Mike at 5/31/2006 8:53:44 AM
Greetings, We are trying to use sp_executesql to perform integration of SQL Server 2005 with a .NET application. We are receiving an error "Incorrect syntax near <sp_name>" which we have been able to verify is working via direct query. So in other words, ... sp_name ....succeeds, wher...more >>

Extended Property
Posted by S Chapman at 5/31/2006 8:29:57 AM
How do I query the extended property of a column (like MS_Description property). I run the following query and SqlServer returns nothing. But I see the description in enterprise manager. Am I missing anything here please? SELECT * FROM ::fn_listextendedproperty (N'MS_Description', N'us...more >>

@return_status from SQLCLR stored procedure
Posted by Greg Larsen at 5/31/2006 8:29:02 AM
I'm trying to write a VB CLR stored procedure that will set the return status to 0 or 1 depending on whether the CLR was successful or not. How do I do that? Basically I want to use the following T-SQL code to call my CLR and set the @return_status declare @return_status int EXEC @return...more >>

Combine two int columns into one bigint column
Posted by kerplunkwhoops NO[at]SPAM yahoo.co.uk at 5/31/2006 6:59:35 AM
Hello I have created a database that uses an int for the table primary keys. This database is being deployed at several sites. Each site has a unique site ID which is less than 100. There is another database that acts as a master viewer. This database holds a copy of all the site database...more >>

SQL select question - simplify my code pls
Posted by Swoosh at 5/31/2006 6:03:18 AM
I have this select: SELECT [Category_ID], [Category_Cd], [Category_Dsc] FROM [PMO_TBL_EMP_CATEGORY] it returns me a nice small list (3 columns) whic is the easiest way to have a 4th column which contains Count(*) So basically i want to do this: SELECT [Category_ID], [Category_Cd], [Cat...more >>

Select - Basic Question
Posted by S Chapman at 5/31/2006 5:28:07 AM
In terms of performance which one is better? 1. SELECT * FROM table_name OR 2. SELECT column1, column2........lastColumn FROM table_name ? Thanks ...more >>

Pass record to user-defined function and create xml
Posted by porsch55 NO[at]SPAM yahoo.com at 5/31/2006 5:15:06 AM
Does anyone know if there is a way to pass a record from a select to a user defined function in SQL Server 2000? The number and names of the columns in the record will vary depending on the upload temp table selected from... You should be able to see what I am trying to accomplish bellow... If y...more >>

Datalength of unicode and non-unicode types?
Posted by pedestrian via SQLMonster.com at 5/31/2006 2:35:18 AM
I'm using SQL Server 2000. Suppose I'm in Northwind database and I execute the following query: SELECT Notes, Datalength(Notes) As 'Text length' FROM Employees The results of 'Text length' shows 2 X total characters because Notes is of type ntext (Unicode type). Q: How to form a query ...more >>

Data type problem
Posted by Chandra at 5/31/2006 2:22:02 AM
Arithmetic overflow error converting numeric to data type numeric. I'm getting this error when I'm trying to insert. this is my SQL insert into ABSCTRL ( ID, column1 ) values ('123',12) ID is char (4) Column1 is decimal(4,1) in the database table. Please let me know why I'm ge...more >>

Using Aggregate functions in joins
Posted by Rajeev at 5/31/2006 12:17:28 AM
Hi, SELECT amount, currencycode FROM Expenses (NOLOCK) We have to select the latest exchnage rate from other table EXCHANGE_RATE.. this table will contain exchange rate of every date. We have to take the exchage rate for the latest day and use for calculating amount in the expenses tabl...more >>

getting null values
Posted by Frederik Vanderhaeghe at 5/31/2006 12:00:00 AM
Hi, I want to build up a table with which hours my site is being watched, i have the data in a table and i can get it out. But what I get is just the hours that it has been watched and for the hours that haven't been watched I would like to get 0. Example 0 0 1 5 2 0 3 0 4 ...more >>

Simple Question - update statment
Posted by Agnes at 5/31/2006 12:00:00 AM
I got a field whose date is '2006-04-30' How can I update statement to change the date into '2006-04-01' thanks a lot ...more >>

Leading zero's
Posted by Bart Steur at 5/31/2006 12:00:00 AM
How do you add leading zeroes to a string when converting a number? ie. Number = 300 CONVERT(varchar,Number) results in '300', but I would like to have '00000300' How? ...more >>

Stored Procedure input string parameter
Posted by Alan at 5/31/2006 12:00:00 AM
CREATE PROCEDURE Demo_FTS @SQL varchar(128) AS select * from openquery(demo, @SQL) GO Anyone knows what did I do incorrectly ? I got error: Incorrect syntax near '@SQL' ...more >>

generating DDL
Posted by arch at 5/31/2006 12:00:00 AM
In Oracle, there is a system packaged function that returns the DDL for a database object (DBMS_METADATA.GET_DDL). What is the equivalent in SQL Server? ...more >>

order by day
Posted by Frederik Vanderhaeghe at 5/31/2006 12:00:00 AM
Hi, I have a query but I would like the result to be: sunday monday tuesday wednesday thursday friday saturday 44 157 153 222 74 455 22 how can i assure that it is sorted by day?? Always first sunday, then monday, ... Fré ...more >>

How SUSER_SNAME works?
Posted by Pushkar at 5/31/2006 12:00:00 AM
Hi, I want to use SUSER_SNAME() in my application, but I don't how does this function resolves the windows SID. In whose context it does the resolution? I have added a Windows group of a trusted domain to my SQL Server and then a memeber of that group connect to SQL Server, then how does SQL ...more >>

sql question
Posted by x taol at 5/30/2006 9:49:02 PM
i want to a query. SELECT MAX(fNum) FROM tTable WHERE fDate IN (SELECT MAX(fDate) FROM tTable WHERE fDate IN (SELECT fDate FROM tTable WHERE fDate IN (SELECT fDate FROM tTable WHERE (fRegion="Califo") AND (fProduct="G274") AND (fColor="Brown") AND (fDate<=#5/13/2006#)))) unfortuna...more >>

Accessing stored proc multiple return values
Posted by evs at 5/30/2006 9:38:45 PM
Hi, I have a problem. I have two stored procs. One I am building currently (sp_load) and another that is already in the data warehouse and which I have no control over (sp_log_event). sp_log_event is for control logging. It accepts a process name parameter. It outputs 3 return parameters by...more >>

Random error - Insert Into Table1 Select * From Table2
Posted by ausgoodman NO[at]SPAM hotmail.com at 5/30/2006 9:37:37 PM
Hi All SQL Server 2k gurus, I got random error when I try to run the following sp (seems always has problem when Insert into table when run this procedure in a loop to join several tables into one big table): ---------------------------------------------------------------------------------...more >>

word suggest
Posted by Howard at 5/30/2006 9:10:14 PM
In goold if you type in ditionary It will ask you if you mean to type the word dictionary. Is this something that can be done easily with a sql query? If not can someone point me to the right direction as to how to write something like this? Thanks, Howard ...more >>

Replicating Table
Posted by wrytat at 5/30/2006 8:02:01 PM
How do I write a SQL statement that can replicate table without specifying the data columns? For example, I have Table A with 12 columns, and I want to create Table B with exactly the same fields and data type. Is there an easy way out?...more >>

Queries with Dates
Posted by Tony K at 5/30/2006 7:49:05 PM
New to SQL. I'm trying to include 2 dates in a query. They query works, but not logically. I'm sure I'm missing something small. When the query runs, it doesn't include dates that have times later than 12:00:00AM. How do I get rid of that? SELECT dbo.Orders.OrderID, dbo.Orders.Cust...more >>

Question for changing results in sql
Posted by Lydia Moia at 5/30/2006 7:40:50 PM
I have to change the result for Mats(who has the apparatus id of 3) to a score of 8 for the student with the id of 6415(this student has the school_id of 5) *** Sent via Developersdex http://www.developersdex.com ***...more >>

Checking for duplicates
Posted by toedipper at 5/30/2006 6:55:56 PM
Hi, I have to run through a list of tables and check for duplicates. The tables have no primary key setup but we expect that there should be only 1 record for a combination of fields. So for example if I keep it simple and imagine there is a table called customers with loads of fields a...more >>

UDFs, Determinism and Constraints in SQL Server 2000
Posted by aspnyc NO[at]SPAM gmail.com at 5/30/2006 5:54:27 PM
I'm having problems with creating a UNIQUE constraint that references one normal column and one virtual/calculated column. The calculated column uses a user-defined function (UDF) to get its value, and the same UDF is used to create a CHECK constraint. Here's the code /* BEGIN CODE */ CRE...more >>

editor + VS 2005 ?
Posted by Jarod at 5/30/2006 4:51:57 PM
Hey What tool for T-SQL with Intellisense and other nice stuff will you recommend ? Preferably to use as add-on for VS 2005 but not as a must. Jarod ...more >>

Changing all Int to Bigint
Posted by YC at 5/30/2006 4:05:30 PM
Hi, We need to change all Int data types to Bigint. Considering the number of tables and View tables, changing manually one by one is not a option. Is there a nicer way of changing all (hundreds of them) in more automatic way? YC ...more >>

Need to select random records from a given query
Posted by Richard West at 5/30/2006 2:57:02 PM
I'm looking for a query that can return a random sampling of records meeting the where clause criteria. For example I might have a total of 5,000 rows that match my where clause, however I need to retrieve only 250 of these records - but they must be randonly selected. I need to be able to ...more >>

Copying a table form one database to another
Posted by dave m at 5/30/2006 2:42:46 PM
To be brief, I need to copy a table (schema and data) from one SQL Server (2K) database and to another SQL Server database on the same PC. With MS Access, I was able to use a SELECT INTO statement to move data between databases by the use of the IN clause to a newly created table in an extern...more >>

PIVOT ISSUE
Posted by Troutbum at 5/30/2006 2:02:31 PM
I have the following table structure and would like to pivot the data below. The table was comprised of raw data grouped to find the count. count question choice question2 choice2 ----------- ---------- --------- ------------ ----------...more >>

Update multiple records - SQL
Posted by Keith Kubicek at 5/30/2006 1:18:08 PM
Hello all, I have 95 records in room 1233 Code: -------------------- SELECT * FROM Inventory WHERE (Inventory.Room_No LIKE 1233) -- 95 rows- -------------------- I want to change them to room 132C: Code: -------------------- UPDATE Inventory SET Room_No ...more >>


DevelopmentNow Blog