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 > july 2006 > threads for monday july 10

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

SQL SVR 2000 & 2005Express side-by-side
Posted by Micus at 7/10/2006 11:24:44 PM
Hello, I'm new to SQL Server and I have 2000 and 2005Exp on the same machine. I created a database/tables in 2000 then tried to use VC++2005 Express to access the database... 'tried' being the operative word. Can 2000 and 2005Exp be on the same machine? Can 2000 be accessed using VC++20...more >>

Multiple Columns from One Column
Posted by Joyce Perry at 7/10/2006 9:19:16 PM
Hi folks, I have a table named LineItems containing sales by item from years 2004-2006. Columns are ItemID, SaleMonth (datetime where all lines are dated the first day of the month), Qty, Price and Total. I need a query that returns something like this for any specified ItemID: Month....more >>

unresolved external symbol _SQLCODE
Posted by gcorrea at 7/10/2006 9:16:01 PM
Hi I'm migrating an application from Oracle to MS-SQL-Server. This application was developed with "C" (KR) and PRO*C. For this purpose I'm using the ESQL precompiler nsqlprep (Microsoft (R) Embedded SQL for C Pre-Compiler. Version 8.00.194.). I had made some adjustments to the PRO*C em...more >>

Improving Store procedures
Posted by Kenny M. at 7/10/2006 8:36:01 PM
I use conditional to test if a value was passed Is there a more professional way to do the same? Where can I read to learn to write SP in a pro way? CREATE PROCEDURE GetProductByParameters ( @CategoID int , @SupplierID int, @Order nvarchar (30) ) AS DECLARE @Sqlstring VARCHAR...more >>

bcp - is there an option to truncate or reject a row with a column size longer than defined?
Posted by Jiho Han at 7/10/2006 8:35:54 PM
I have some string type fields in a source file that is longer than the columns defined in the table. Does bcp tool have an option to reject a row and possible log it and/or truncate it? I looked in BOL but could not find any info. Thanks for your assistance. Jiho Han Senior Software En...more >>

Validations
Posted by Robert Bravery at 7/10/2006 7:22:51 PM
HI all, Having a discusion with a colegue. Where is the best place to keep validatations, in the database layer, i on the SQL server via triggers, SP etc; or at the application layer, This being a database group I gather that the bias would be towards the DL, but what , in you minds are the p...more >>

Will this select statement work?
Posted by Dan Marth at 7/10/2006 6:20:37 PM
SELECT * FROM blat ORDER BY CASE @col WHEN 'firstname' THEN firstname WHEN 'email' THEN email END I am folowing these http://www.aspfaq.com/show.asp?id=2501 examples but I am getting correct results back. Just wonding if something is wrong w...more >>

Filter stored procedures by alter date
Posted by Diego F. at 7/10/2006 5:46:26 PM
Hi all. Is it possible to filter in SQL Server 2005 stored procedures that have been modified after a specific date? I need to execute some procedures that I have in my DB, but the only way to know which I have to execute, is with the modification date. -- Regards, Diego F. ...more >>



Get output of xp_cmdshell programmatically
Posted by Waldy at 7/10/2006 5:15:13 PM
Hi there, I want to return the output of cmdshell to a table. Is this possible? The only thing it seems to return is the row count. ...more >>

Transaction Question
Posted by evgenybr via SQLMonster.com at 7/10/2006 4:50:14 PM
Hi all, I want to know is there are some limit to user defined transaction, i mean i do a lot of insertion/updating to tables in transaction BEGIN TRAN Insert to table1 Insert to table2 Insert to table3 Insert to table4 Insert to table5 ....... ............. ............ COMMIT...more >>

Internal SQL Server error
Posted by simonZ at 7/10/2006 4:30:45 PM
I have sql2000. I have one large select statement: SELECT T2.column1,T2.column2,T2.column3 FROM(...........) as T2 it works. If I use Group By: SELECT T2.column1,T2.column2,T2.column3 FROM(...........) as T2 GROUP BY T2.column1,T2.column2,T2.column3 I get the following error me...more >>

70-431 (MCTS -SQL)
Posted by WPH at 7/10/2006 4:21:02 PM
Hi, Somebody can speak (tips) about exam 70-431? Tips? Amount Questions? Time ? -- SQL Server 2000/2005...more >>

How to get 12 months of data in a query
Posted by Chamark via SQLMonster.com at 7/10/2006 3:38:06 PM
In Microsoft Access I could use this query to get 12 months worth of data broken down on a per month basis: SELECT Format([DATE],"yyyy-mm") AS [Month], [National Call Stats].Segment, Sum([National Call Stats].NchQty) AS SumOfNchQty, Sum([National Call Stats]. SchdOpenSecsQty) AS SumOfSchdOpenS...more >>

Calculation based on 'previous' row value
Posted by Carl Imthurn at 7/10/2006 2:45:06 PM
/* How does one go about calculating the difference in column values between the current row and the previous row (having a defined sort order to determine "current" and "previous")? Here's some DDL: */ IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'dbo.#TEMP') AND OBJECTPROPERTY...more >>

data inserts between servers
Posted by john d at 7/10/2006 1:30:01 PM
I have a situation where tables are updated in several tables in one database on a particular server. Need to know how to manually kick off an insert of the same data to another server, another database, to similiarly named tables. The question is what is the syntax for login and password a...more >>

Changing Passwords App (SQL 05)
Posted by JP at 7/10/2006 1:13:02 PM
Hi, I'm working on an web-app (VB.net 2005) that will enable users to change their SQL Server password. I've been reading about two techniques: The T-SQL Alter Login that DOES not accept parameters, therefore is useless to me and the one using the Microsoft.SqlServer.Management.Smo/common ...more >>

DELETING from related Tables
Posted by don larry at 7/10/2006 12:44:58 PM
Greetings, I have TABLE1 with pk=CustID, and TABLE2 with fk=CustID. I want to delete from both of these tables at the same time, based on CustID. I do not want to alter table structure to include ON DELETE CASCADE because TABLE1 has other related tables which I do not want affected. An...more >>

row counting from sysindexes table
Posted by hrhoe at 7/10/2006 10:12:01 AM
Hi, I've been used the following command in my stored procedure to get the row count: use <db_name> DBCC UPDATEUSAGE ('<db_name>', '<table_name>') set @Count = (SELECT rows FROM sysindexes WHERE id = OBJECT_ID ('<table_name>') AND idid<2) print CAST(@Count as varchar(20)) .... It works f...more >>

COUNT(*) on 1M rows with subqueries: must this be so slow?
Posted by dmlinliverpool NO[at]SPAM netscape.net at 7/10/2006 9:58:47 AM
Hi In the system I support there is a FutureClients table which contains all the clients the company is trying to sell to. A Salesman (it seems they _are_ all men!) can make an appointment to pitch, invite clients to a factory visit, schedule a neogtiation meeting with the sales manager, ...more >>

Transfer to excel
Posted by Reggie at 7/10/2006 9:45:57 AM
Hi and TIA! I have an ASP.Net(VB) site that maintains parts for the military. They have requested the ability to click a button on my site which will let them upload a text file containing 100 or more part numbers. I will then place them in an SQL temp table. I will then run a procedure th...more >>

Error: 26 in SQL Database
Posted by David at 7/10/2006 9:31:05 AM
Hello to all, My problem is probably a pretty common one but so far no solution that ive come across has worked. I have a logon page that I wrote in Visual Studio 2005 that access a database (standard database name) to look up a username and password match. It runs perfectly on my machine, no ...more >>

How to select a list of Views for a user
Posted by hals_left at 7/10/2006 9:28:50 AM
I want t odiplay a list of views that a certain user has SELECT permissions on, is this possible ( SQL 2000 Standard). Thanks. ...more >>

Scripting SQL Server Jobs
Posted by A. Robinson at 7/10/2006 8:51:02 AM
I was looking for a way to script multiple SQL jopbs to a .sql file... I know you can script individual jobs via the gui, and you can transfer jobs using the Transfer Jobs DTS task, but you're unable to multi-select jobs in the gui and then script them all - unless I'm looking in the wrong pl...more >>

Parallel / waiting processing from VB.Net 2005
Posted by ck at 7/10/2006 8:46:25 AM
I have some script: strSQL = "INSERT INTO xxLog (LogText) SELECT 'INSERTED ' + cast((select count(*) from xxRAW_PG_NEW where DateReceived IS NULL) as varchar(10)) + ' rows into xxRAW_PG_NEW';" cmdReader.CommandText = strSQL cmdReader.ExecuteNonQuery() strSQL...more >>

Could not relay results of procedure
Posted by cata at 7/10/2006 8:05:02 AM
Can you please help me with some ideas about what is causing this and how to fix it. Could not relay results of procedure 'sp_executesql' from remote server 'TOSQLDMSCLS'. [SQLSTATE 42000] (Error 7221) [SQLSTATE 01000] (Error 7312). Both servers are SQL Server SP4, 8.00.2040 Win 5....more >>

Isnull function does not return value as desired
Posted by Jack at 7/10/2006 8:04:02 AM
Hi, I am trying to test the isnull value using the pubs database. I am trying to use the following code: select emp_id, isnull(minit, 'NONE') as minit from employee However, the minit field is not getting replaced with NONE whenever we have a null value for the minit field. I am wondering...more >>

How to tune a CTE to not return duplicate rows in SQL 2K5
Posted by ryan.Q.heath NO[at]SPAM gmail.com at 7/10/2006 8:00:32 AM
I have a table with two columns: Friendship( UserID1, UserID2) Now I'd like to create a path of friends from one user to another user. So I started off with a cool recursive CTE friends like with friends ( userid, friendid, level) as ( select userid1, userid2, 0 from friendship whe...more >>

Updating old Table
Posted by Stute at 7/10/2006 7:57:59 AM
Hi All, I have created a new table as BILLSUM by importing few columns from BILLREF table. The table was created with the below query..... SELECT REFNO, SUM(INVOICE) INTO BILLSUM FROM BILLREF GROUP BY REFNO HAVING SUM(INVOICE) <> 0 However, the BILLREF table rows were updated with new...more >>

BCP using ODBC - problem with unique identifier
Posted by mpietrzyk NO[at]SPAM autograf.pl at 7/10/2006 7:51:28 AM
Hi guys I'm having a nasty problem with bulk copying into a table that has unique identifier column. I'm coding on C++, using ODBC driver. I'm coping from a file containing UID description like this: {43B5B3DE-5280-4CBF-B357-D9E57651F0D1} (I also tried a non-bracket version) and in the D...more >>

Question with begin and end block
Posted by Jack at 7/10/2006 7:32:02 AM
Hi, I have the following code where I am trying to check the utility of BEGIN END block. if (select count(*) from employee where minit = '' ) > 1 BEGIN PRINT 'There is no middle name for some of the employees' PRINT 'Do you want to change the null value of minit field for those e...more >>

SQL Server 2005 query doesn't use proper indexes
Posted by MLB at 7/10/2006 7:16:15 AM
Hello, We are just migrated from SQL Server 2000 to 2005. In this process we have converted the mdf to 2005 mode and run the update usage and update statitistics. This wend al fine. >From this moment al lot of queries are running slow on the machine. >From the execution plans of some of tho...more >>

change null to 0....... using query
Posted by x taol at 7/10/2006 6:34:12 AM
table name : table1 field name : fld1, fld2, fld3 field type all integer data is below..... fld1 fld2 fld3 1 4 3 7 5 i want to make null value to 0 value. i want to make the result below. fld1 fld2 fld3 1 0 4 0 3 0 7 5 0 ...more >>

make continuous number from query
Posted by x taol at 7/10/2006 4:48:26 AM
table name : tbl field name : fld1 fields count : 1 look at the below data.... fld1 aa bb aa cc aa i want to make the below result using query. num fld1 1 aa 2 bb 3 cc *** Sent via Developersdex http://www.developersdex.com ***...more >>

restore .bak with sql 2005 express
Posted by calvi at 7/10/2006 4:40:47 AM
Using MS SQL Server 2005 Express edition: I want to restore database with menu: right click mouse on database, tasks, restore, database. to database: mydatabase. from device: add mydatabase.bak then I click ok, ok. I received an error: Restore failed for Server 'Servername'. Additional informa...more >>

Translating rows into columns
Posted by JumpingMattFlash at 7/10/2006 3:41:01 AM
I've got a bit of a problem with trying to achieve the goal as per title. I understand how i can translate a set number of rows into columns using joins, however i have now been presented with a problem where by i need to combine the results of two different join types. I will explain: Cust...more >>

Calling SP within another SP with output param
Posted by frohlinger NO[at]SPAM yahoo.com at 7/10/2006 12:18:33 AM
Hi, I am trying to exec a SP within another SP with output param, and I always get NULL value in the output param. The first SP: CREATE PROCEDURE insertName ( @Name NVARCHAR (50), @UserID INT OUTPUT ) AS INSERT INTO Users (UserName) VALUES (@Name) SELECT @UserID = @@IDENTITY ...more >>

TEXT/NTEXT question
Posted by evgenybr via SQLMonster.com at 7/10/2006 12:00:00 AM
Hi all I want to perform Insert into Table1 ….. select from tableFunction I wrote table function that accept ntext parameter. Also I have some table Table2 with ntext column from which I want to take the data. With While I want to over on this table and for each value of ntext colum...more >>

Auto Generate CustomerID
Posted by Chris at 7/10/2006 12:00:00 AM
I have a CustomerID field varchar(8). I would like to auto generate a customer ID based on a 3 letter prefix plus 5 characters for the unique number based on that prefix. If the prefix is ABC then the first customer generated should be ABC00001 the next should be ABC00002, then ABC00003 and ...more >>

SP_Rename
Posted by Justin at 7/10/2006 12:00:00 AM
Hi, I'm having issues with SP_Rename, whenever I run the SP, i get the caution: 'Caution: Changing any part of an object name could break scripts and stored procedures. The object was renamed to 'test'.' When running: SP_Rename 'test', 'test1' Is there a way that SQL Serve...more >>


DevelopmentNow Blog