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 > october 2004 > threads for monday october 18

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

SET NOCOUNT ON OPTION
Posted by Leon at 10/18/2004 9:35:17 PM
When and when not to set SET NOCOUNT ON? I know what it does but not exactly where and when I want to use it. ...more >>

Design for store pocedure if return more than 1 record
Posted by davidku NO[at]SPAM rocketmail.com at 10/18/2004 8:25:54 PM
Hi Experts, I would like to seek your opinion on how to solve or handle this type of scenario. Store procedure - p_GetCustomerEmail can be accessed from ASP webpage and another Store procedure calls. CREATE PROCEDURE p_GetCustomerEmail @CustNo INT, @CustName CHAR(50), @CustEmail CH...more >>

Is recommended the intensive use of sp_OA... XP?
Posted by David at 10/18/2004 6:20:52 PM
I want to use the sp_OACreate to create an instace of MSXML, something like this... Exec master..sp_OACreate 'MSXML2.ServerXMLHTTP', @token OUTPUT And I want to get the XML from a URL EXEC master..sp_OAMethod @token, 'open', NULL, 'GET', @Url EXEC master..sp_OAMethod @token, 'se...more >>

Default TCP/IP Port for SQL and performance
Posted by Patrick at 10/18/2004 5:40:20 PM
Hi Freinds, What is the default SQL TCP/IP port? and if I chabge it to smt like 1471, dows it have effect on performance? Thanks in advance, Pat ...more >>

Do CPU and RAM have any effect on performance?
Posted by Patrick at 10/18/2004 5:38:17 PM
Hi Freinds, I know that SQLSERVER is RAM hungry. We are using a box with 4 CPU and 8 Gb RAM Bur still very slow and slower than my other 2CPU/4Mb machine ! What could be wrong? Thanks in advance, Pat ...more >>

Returning data from an empty value field
Posted by Jaygo at 10/18/2004 5:37:11 PM
Hi, I have an orders table (testing server) that contains an empty fields "sentBy" column until the order item is dispatched, how can I see what orders are waiting dispatch by using a query as I am unsure what the WHERE value should be to return a zero or empty value. SELECT orderID, orderD...more >>

Restore takes LONG TIME
Posted by Patrick at 10/18/2004 5:31:24 PM
Hi Freinds, My restore process take aery very long time to complete ! I ran Profiler but don't see any action going on . What could be the reasons ? Thanks in advance, Pat ...more >>

Can you update the transactions feeding a group by clause
Posted by steve_lemon at 10/18/2004 4:41:27 PM
I'm in the process of constructing a query to create invoices and I just want to double check something before proceeding. I'd appreciate any comments and suggestions on the following scenario. I'm selecting transactions from a table and using the group by clause to group them by client and pr...more >>



right outer join
Posted by Gene Vangampelaere at 10/18/2004 4:38:47 PM
I have a problem with my outer join : I only get 1 record as result, I want to get 7 records (see table dossierstructuur) This is the result I get : ROWID onderverd omschr bespreking ----------- ------------ --------- ------------- 2 1. ALGEMEEN petechieen ...more >>

Differential Backup Script
Posted by Joe K. at 10/18/2004 3:59:03 PM
I am looking for a SQL Server Differential Backup script that creates a weekly full backup and daily differential backups. Hopefully the script would be like the SQL Server maintenance job deletes files in the directory they are older than 3 days for differential backups and replaces (delet...more >>

SELECT tables with rows
Posted by Patrick Rouse [MVP] at 10/18/2004 3:29:03 PM
I'd like to quickly figure out which tables in my database contain records. Can someone help me to SELECT all "user" tables that contain rows. -- Patrick Rouse Microsoft MVP - Terminal Server http://www.workthin.com ...more >>

select random row
Posted by Sharon Tal at 10/18/2004 3:26:40 PM
Hi all. I need to select a random row from a table. I was thinking of getting a random_number < MAX(id) and > MIN(id) and select * where id = random_number. The problem is that the ids are not consistent. So i could get an empty query. Maybe i can make a view that creates new ids, and select f...more >>

Synchronize Table Operations
Posted by Binder at 10/18/2004 3:06:52 PM
I have a table that represents a queue of rows to be processed. I want to have multiple servers on the network that work on the queue. I am using ADO functionality to access the table. What architecture/functionality should be employed to allow only one server out of the group to process a gi...more >>

SQL View Automation
Posted by Steve at 10/18/2004 3:05:01 PM
Hi, Can someone help me with the following I get a new set of data every week. Each week a partitioned table is created automatically. This data is inserted in the partiotned table. Using Northwind Example: Customers Table Suppose I have three weeks of data therefore I have 3 partitioned...more >>

potential top
Posted by CGW at 10/18/2004 3:03:02 PM
When executing a top query, is there a way to return (in the same query) a rowcount for what the query would return without the top? For example SELECT TOP 100 FROM MyTable WHERE MyCondition Can I add something to that query to return what the COUNT (*) would be without the "top 100" at ...more >>

Adding Row Level Versioning
Posted by Mark Jerde at 10/18/2004 2:52:56 PM
I have a 6-table, 1 MB MS Access database that generates a 149-page section of a Word document. I expect this to grow to 500+ pages. I'm considering upsizing to SQL Server 2000, hence the cross post. ;-) The tables are normalized; data is not duplicated. I would like to extend the schema t...more >>

Stored Procedure woes!!
Posted by Ivan Debono at 10/18/2004 2:19:19 PM
Hi all, I have the following stored procedure: CREATE PROCEDURE gross_net_vat_calculation @id_no_vat int, @booking_date datetime, @amount_gross money as select DMBTR = case when percentage = 0 then @amount_gross else round((@amount_gross / (100+percentage) * 100),2) end, MWSTS =...more >>

Validation Stored Procedure
Posted by Leon at 10/18/2004 2:02:26 PM
Is There a better way I could have written the following stored procedure? Or is my way cool? Checking: Username, Password, Activation = True CREATE PROCEDURE GetAuthorization ( @Username Varchar( 20 ), @Password Varchar( 16 ) ) AS DECLARE @AccountID INT SELECT @AccountID = Accoun...more >>

how to read this XML from SQL?
Posted by David at 10/18/2004 2:01:57 PM
I have this XML... <?xml version="1.0" encoding="utf-8" ?> <int xmlns="http://myurl">0</int> I want to read, assuming that the XML is loaded in the @doc variable DECLARE @idoc int --DECLARE @doc varchar(1000) EXEC sp_xml_preparedocument @idoc OUTPUT, @doc SELECT * FROM OPENXM...more >>

Restart SQLServer
Posted by Johnny van Cadsand at 10/18/2004 1:56:51 PM
Hi, Is it possible to restart SQLServer and the Agent from within a job? Calling a batch file with NET STOP SQLSERVERAGENT NET STOP SQLSERVER NET START SQLSERVER NET START SQLSERVERAGENT doesn't work because if you're in a job and the agent stops then the job gets canceled. Any other id...more >>

Poor Query Performance inside SP
Posted by Ali Salem at 10/18/2004 1:35:09 PM
Hello, I am having a query that is performing poorly inside an SP. The query was supported by a set of indexes to boost its performance. The same query is running good on query analyzer, however when i run from inside a SP that query is running far slowly than query analyzer although i am g...more >>

update question
Posted by John at 10/18/2004 1:35:07 PM
can you update date a column with an if then statement. This is a simple example and I want to do something more complex, but I can't figure out how to do this simple example. can someone help? update car set field1 = (if (select passengers from car where id=1)='3' begin '2' end) ...more >>

Meta Data
Posted by DBAnewbie at 10/18/2004 1:33:09 PM
Hi! I have a table defining the meta data for a database. (TableName, FieldName, FieldType) There are 49 unique tables and I started to create them manually. I would like to create a T-SQL script that will generate all tables and fields. Any ideas where to start? Thanks. Dee ...more >>

sql install
Posted by Hrvoje Voda at 10/18/2004 1:27:40 PM
I installed sql server 2000. But, I was playing with names, and now i can't access to sql database. Then i uninstall it, and install it again, but he keep showing message "Some files pending for information. Restart before running setup". I restarted computer several times, but this message ke...more >>

Advice on Indexes
Posted by IBI at 10/18/2004 12:55:25 PM
I am just curious on how SQL Server stores index internally. What I mean is if there is a way to dig into the Index page to see what is actually stored there. Some sort of undocumented commands, procedures etc. Anyone has any insights on this?? -M ...more >>

Get a Row that has Maximum Salary
Posted by Ponnurangam at 10/18/2004 12:37:27 PM
Hi, I have an Employee Table. I am looking for a query that would return me a row of data of that table which has Maximum salary Ponnurangam ...more >>

OPENROWSET problem
Posted by Yuri Kazarov at 10/18/2004 12:29:12 PM
Hi guys! I'm trying to get a recordset from access into T-SQL and openrowset returns this error: "OLE DB error trace [Non-interface error: OLE DB provider unable to process object, since the object has no columns" my sql looks like this: "select a, b, c,... from tbl", it has about thirty field...more >>

SQL Query Question
Posted by Steve at 10/18/2004 12:05:03 PM
Hi, Can someone help me with the following when I try the following select count(*) from dept d, dept_status dd where d.dept_number = dd.dept_number I get the error message Server: Msg 8115, Level 16, State 2, Line 1 Arithmetic overflow error converting expression to data type in...more >>

Sample application?
Posted by Neil W. at 10/18/2004 11:54:47 AM
Is there a sample Northwind application written in VB or VFP that uses the Northwind SQL database? Thanks. ...more >>

Heterogeneous Query?
Posted by Mike Labosh at 10/18/2004 11:50:40 AM
I tried to run the statement below on my laptop where I have a developmental copy of the database. HorSql01 is a linked SQL Server. Both machines are using SQL Server 2000 -- Fill in the 16 erroneous null VendorKey values UPDATE SoftwareProduct SET SoftwareProduct.VendorKey = av.Vendor...more >>

DBReindex & Fill Factor
Posted by Ed at 10/18/2004 11:33:07 AM
Hi, I would like to know how often I need to Reindex all the tables and under what situation I need to do that... How often I need to recompile the stored procedure, too?? Also, when I reindex the table, should I set the Fill Factor to be 0??? Can someone explain to me more details p...more >>

A SELECT statement that assigns a value to a variable must not be
Posted by KritiVerma NO[at]SPAM hotmail.com at 10/18/2004 10:53:04 AM
I am having a Set Statement inside a cursor and I am getting the Error on this line as A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations. SET @LastPaymentReceivedDate = 0.0 Set @LastPaymentRcvdDateInCurrentQtr = -1 Please advice ...more >>

SP
Posted by Justin Drennan at 10/18/2004 10:38:39 AM
Is there a way to raise an error in a SP, and if that error occurs, the SP is rolled back? If so, how? I'm using Begin Transaction, and Raiseerror event, however this does not seem to do the job? thanks ...more >>

Update fields but assign random numbers
Posted by PEJO at 10/18/2004 10:05:35 AM
Is it possible in SQL (not t-sql) unfortunately it's an Access DB i've got to work with to run an update statement that would assign random nubers to a field. (they don't have to be Unique either). I need to be able to run it once a week through an update statement. So I can't use the Access a...more >>

Newbie SQL query to ActiveDirectory
Posted by Lance at 10/18/2004 9:59:08 AM
I've written simple SQL 2000 queries to our ActiveDirectory via a linked server (using LDAP dialect). I'm now trying to write a query that returns a recordset with rows grouped by the AD container they occur in: Our Active Directory has a container 'Departments'. Under that container are sev...more >>

How to make a Foreing Key?
Posted by Jesus Cardenas at 10/18/2004 9:36:02 AM
Hi, below are the code DDL , Supose I have this tables DETAIL, HEADER and ITEMS and I want to add in the table DETAIL a Foreing Key ITEMS.CUSTOMER , ITEMS.PRODUCT but I can't do this. Because in the DETAIL table I don't have the field CUSTOMER Should I ADD a field CUSTOMER in the table DETA...more >>

assigning an array to a variable
Posted by Scott McNair at 10/18/2004 9:31:57 AM
I'm using a statement along the lines of: SELECT * FROM TABLE WHERE FIELDX IN ('abc','rd9','blah','etc',so on') Is there a way to assign the array to a variable, for example: DECLARE @Array AS ARRAY SET @Array = ('abc','rd9','blah','etc','so on') SELECT * FROM TABLE WHERE FI...more >>

DTS Package Issues
Posted by Scott McNair at 10/18/2004 9:12:53 AM
I've got a SQL Server 2000 environment with production data on a remote server, and an MSDE instance on my local box for development. I'm running into problems with my DTS packages that replicate data to my MSDE box. I can create a DTS just fine, and it runs without a hitch; however when I ...more >>

Need design advice on table
Posted by dw at 10/18/2004 9:11:17 AM
Hello, all. I'm building a database for a Web immunization-record storage system. One input screen has me puzzled as how to best design one of the tables. The part that has me puzzled is this: For each immunization that is required, there are anywhere from 1 to 5 rules, and each rule has diffe...more >>

OPENQUERY
Posted by Chris at 10/18/2004 9:11:03 AM
Hi, Can I join tables from two databases via OPENQUERY? Where can I find advance info on OPENQUERY? Thanks...more >>

SQL Server Clustering DB Advice
Posted by Mark at 10/18/2004 8:45:02 AM
I have question about setting up DBs on Clustered environment. I have to set up 2 nodes on SQL 2k. (Active/Passive). I am going to have one central server for the data. Now how does setting up clustering work on SQL End?? Do master, model, msdb, tempdb go to the same location where rest of th...more >>

DB Advice
Posted by Mark at 10/18/2004 8:29:01 AM
I have question about setting up DBs on Clustered environment. I have to set up 2 nodes on SQL 2k. (Active/Passive). I am going to have one central server for the data. Now how does setting up clustering work on SQL End?? Do master, model, msdb, tempdb go to the same location where rest of th...more >>

Issue with Last()
Posted by Yuri Kazarov at 10/18/2004 8:28:56 AM
Hi! I have an issue with migrating Access database into SQL Server. Is there any SQL Server substitution for the Last() sql function from Access? I couldn't find abything in msdn. I can try to do everything with cursors to get the last record, but is there any easier way to do it??? Thanks fo...more >>

Last updated date of stored procedures
Posted by Ed Chiu at 10/18/2004 8:09:02 AM
Hi, IS there anyway to find to the last updated dates for stored procedures? Not the dates stored procedures were created. Thanks in Adanvce...more >>

Update field based on condition
Posted by John at 10/18/2004 7:55:05 AM
This syntax worked in dbase, but now need it to work in SQL. Thanks in advance to all who may reply. John UPDATE COLLDESC.DBF SET CMS416 = IIF(LEFT(CMS436,2)='08','YES','NO')...more >>

Advice on Query
Posted by Chris at 10/18/2004 6:35:23 AM
Hi, I need to manipulate a history table via linkserver. This table is hugh (VERY) and is currently on a production server. Shou;d I make a copy of the table on another server and manipulate it from there? If so, how do I update the copied table on a daily basis? Or can I just create a view o...more >>

Insert Script
Posted by Filippo Bettinaglio at 10/18/2004 5:45:49 AM
Hi, I have a table with some data in it, I would like to generate one Insert script command for each record. Is there a SQL Server tools for doing it? I mean, this is my table: NamesTbl Name Surname ------------------------------------- Filippo Bettinaglio John Gil...more >>

establishing cause of access violation?
Posted by Bonj at 10/18/2004 5:31:03 AM
Hi I have a mixed managed/unmanaged project which thanks to you guys I've managed to get rid of the linker errors of, so cheers for that. But now I'm experiencing an unknown access violation. Firstly this is an extended stored procedure DLL, I've been able to debug it successfully by starting...more >>

Filter
Posted by Miguel Dias Moura at 10/18/2004 4:46:30 AM
Hello, I am passing 2 parameters in the URL top page "results.aspx": ....?name="john"&book="SQL server" In page "results.aspx" I have a dataset. "names" and "books" are 2 fields. I want to filter all records acoording to the following rules: "names" files contains "name" value AND ...more >>

Rare Query?
Posted by Scorcel at 10/18/2004 4:27:02 AM
Anybody please help me with this query. my table is ddl is: CREATE TABLE [dbo].[testTBL] ( [txtPO] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [dtDateStart] [smalldatetime] NOT NULL , [dtDateEnd] [smalldatetime] NOT NULL , [intQTY] [int] NOT NULL ) ON [PRIMARY] samp...more >>

Automating documentation from my DB
Posted by checcouno at 10/18/2004 3:55:02 AM
Someone can help me in finding some programs that create documentation for my sql server DB? HTML or PDF (better) documentation....more >>

Error Message trapping in stored procedures
Posted by gavin NO[at]SPAM galus.co.uk at 10/18/2004 3:03:51 AM
Hi I have a batch of stored procedures that execute in SQL as scheduled tasks. I want to be able to write the results of the stored procedure calls to an audit table. I can trap @@ERROR after all of my operations to check the result, and store this value away, but I cannot work out how to...more >>

implementing conditional constraint
Posted by gandalf at 10/18/2004 2:43:45 AM
I want an extra validation if the first two characters matches a string upon insert. Can this be implemented using a constraint or do I need a trigger? something like ALTER TABLE orders.dbo.PRODUCTS WITH NOCHECK ADD CONSTRAINT CH_ID_PRODUCT CHECK (CASE LEFT(IDPRODUCT,2) WHEN 'US' CHEC...more >>

DAAB, dataset and stored procedure
Posted by nauna_jia NO[at]SPAM hotmail.com at 10/18/2004 2:39:04 AM
I'm using MS DAAB V2.0 to retrieve a long set of data from a stored procedure, and filled into a dataset, then displayed on the webform. It's no problem in displaying data. However, for update back the modified data, I couldn't find a simple and smart way to do it. I understand that SQL ser...more >>

converting a decimal value o a hexadecimal value
Posted by sevil at 10/18/2004 2:35:14 AM
i want to find the hexadecimal value of a decimal number.For example 12->C,11->B.Is there any existing function which do this in Transact-SQL. ...more >>

Toolbar in Design View of a table?
Posted by Gerald Hopkins at 10/18/2004 1:20:42 AM
Can anyone tell me how to get the toolbar to show in the Design View of a table. It contains the Manage Triggers, Manage Keys and Relationships, etc., buttons. I recently installed SQL Server 2000 on a new XP machine, and I don't see that toolbar. Thanks, Gerald *** Sent via Developersde...more >>

Select distinct of a couple o fields
Posted by checcouno at 10/18/2004 1:17:02 AM
I need to know the number of distinct couple of two fields in my table. The query "SELECT DISTINCT myField1, myField2 FROM myTable" returns me the rowset correct, but i need to know only the number of row with distinct myField1, myField2. Can i use COUNT function and how? Or there is another w...more >>


DevelopmentNow Blog