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 > december 2003 > threads for thursday december 11

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

Converting Access Query to Sql Server 2000
Posted by colpo NO[at]SPAM jippii.fi at 12/11/2003 10:37:36 PM
Hi, I am very new with Sql Server 2000. I should convert Access 2000 database to Sql Server 2000. First problem is how to convert Access queries which include user defined function. I have a normal Access query: Table: Customer Fields: Number, Name, Address and so on. Then I have company ...more >>


May/Can I Pass #TempTable Into Trigger ??
Posted by Tristant at 12/11/2003 10:26:37 PM
Hi SQL Gurus, (Sorry if double post, got wrong timezone setting) I have a Trigger on a Table, but on some condition / variable at runtime (front end), some code in the Trigger must be Skipped. Since I cannot pass @parameter to a Trigger, can I create a #TempTable, then the Trigger must check ...more >>

Joining tables
Posted by Steve at 12/11/2003 9:38:54 PM
How can I wrtie a query that joins 2 or 3 tables without using a SELECT statement? ...more >>

1=2
Posted by Steve at 12/11/2003 9:38:31 PM
In the following statement: select * into Staff3 from Staff2 where 1=2 What does 1=2 mean? ...more >>

Simple SP
Posted by Anirban at 12/11/2003 9:06:55 PM
I have created an stored procedure in northwind db. create proc dbo.getemployeeaddress @employeeid INT, @employeeaddress nvarchar(120) OUTPUT as select @employeeaddress = address+'.'+city+'.'+region+'.'+postalcode+'.'+country from employees where employeeid = @employeeid go Now I want t...more >>

How do I get db ddl properties from sql 2000 like documenter does in MS Access?
Posted by NOSPAM at 12/11/2003 8:53:40 PM
Hi, I am looking for an easy way to get all of the properties from a SQL 2000 database much like the documenter does in MS Access. Any ideas? ...more >>

dts/linked server performance
Posted by microsoft news group at 12/11/2003 8:45:10 PM
Hi All, I am in need to do a server to server copy of data. Which is a better solution for this in terms of performance: dts or linked server and why? Thanks, Sumanta ...more >>

Formating
Posted by wd1153 at 12/11/2003 8:36:05 PM
There is a function in VBA called "format". If I have a number x=12345, and if I always need 6 digits, I can do something like Format(x, "000000" the result would be 012345. Now I'd like to know if there is similar function in TSQL or how do I acomplish the same. thanks...more >>



Paramater Question
Posted by noone at 12/11/2003 8:04:34 PM
database SQL 2000 Dynamic Parameter? I would like to pass a parameter to a procedure from dot net. the relevant part of the query is this: AND ROT_Creative.Contact_id not in (21,22,3) I would like to use a parameter like so AND ROT_Creative.Contact_id not in (@param) I would like the...more >>

Inserting result of procedure in a variable
Posted by Stijn Verrept at 12/11/2003 7:43:17 PM
How do I get the returning value of a SP in a variable? The code I tried but which doesn't work is: set @ActualDiscountDays = exec get_discounts @BeginDate, @SN_ID BTW The last line of the Get_Discounts SP is: select count(*) from #TempDiscount where TD_Date >= @BeginDate and TD_OutCount >=...more >>

Select Distinct Problem
Posted by Budiono at 12/11/2003 7:13:17 PM
hi guys, I want to query my table 'A' with have 20 fields. there a duplicate value in field 'SEQ_01'. i want to select all field and eliminate the duplicate in field 'SEQ_01' using distinct keyword. i already use this statement : select distinct seq_01, city, name, .. from tbl_a where seq_01...more >>

Some testing with IDENTITIES
Posted by dt at 12/11/2003 6:45:54 PM
Hello All -Especially Celko and Doug Miller, Firstly Joe, I think your book SQL For Smarties is great. I have been reading, with much interest, your debates on the IDENTITY attribute of a field for the purpose of a Primary Key in a table. This is important aspect of a new project that I ...more >>

select query
Posted by kloepper at 12/11/2003 6:26:15 PM
I was not clear in my prior post, so I've re-written it slightly, below. My data tables have been reorganized and now I have a new problem. My Where clause has to be restructured in a way that is unknown to me. I now have columns named: Period, Symbol, Revenue This is a flat table at th...more >>

Bulk Insert File Name
Posted by Rao at 12/11/2003 5:53:32 PM
Hi, Any suggestions on giving a String Variable as the File Name in Bulk Insert Command? What I mean is to give something like this -- Bulk Insert From xx (where xx may be 'C:\abcd\xyz.txt' instead of giving Bulk Insert From 'C:\abcd\xyz.txt'. I am getting an error when I try to do this...more >>

Set variable = sum of recordset
Posted by Scott at 12/11/2003 5:40:39 PM
I'm creating a statement that must first retrieve a sum of downtime, set it equal to a variable and then use that variable in a 2nd statement. I just need help with syntax to set the sum of downtime to the below @sTotalDowntime variable. Below is my failed attempt: declare @sTotalDowntime d...more >>

SQL Server running on a Domain Server
Posted by Meir at 12/11/2003 5:11:34 PM
Hi, One of our customers installed SQL Server 2000 on a Domain Controller Server. I cannot manage to connect to SQL using an SQL user (not even sa), by using a trusted connection I do manage to connect. I get an error message that a session could not be initiated for user sa. Any ideas? ...more >>

Database Design Question
Posted by Jason at 12/11/2003 4:14:20 PM
Hi, I have a database that saves Orders. There are many products that an order can have. With this in mind there a 3 main catagories of products. Currently, I have one product table for each catagory because each product has different options. What is the best way to map to each product tab...more >>

Aggregate? Can I count these numbers
Posted by Guogang at 12/11/2003 4:08:30 PM
Take 'pubs' as an example, is it possible to query the following information using a select statement? au_id, number of books with 'price > 10', number of books with 'price <= 10', number of books with 'type=business' ----------------------------------------------------...more >>

Inserting result of procedure + extra columns in a dataset
Posted by Stijn Verrept at 12/11/2003 4:04:39 PM
I know how I can get the results of a procedure inserted in a table: insert into #TempAllForfaits exec get_forfaits @Date, @SNID But now I need the extra field @SNMut added to the insert. So I need the result of the get_forfaits procedure PLUS an extra column which contains the value @SNMut...more >>

performance on COALESCE in view
Posted by Tony Hu at 12/11/2003 3:24:12 PM
I have two tables, which have 28 common fields(name, data type and value are exactly the same), and 6 fields unique to the first table(TableA), and 6 other fields unique to the second table(TableB). I created a view like this: CREATE VIEW model AS SELECT COALESCE(a.x1, b.x1), ...more >>

SQL went mad!!!
Posted by Makjalele at 12/11/2003 3:20:46 PM
[Microsoft][ODBC SQL Server Driver]Unknown token received from SQL Server Data transfering between two databases in SQL2000. WHAT for the fu...k that means? I went crazy by now also!!!! ...more >>

Warning: Null value is eliminated by an aggregate or other SET operation.
Posted by Jason MacKenzie at 12/11/2003 3:00:37 PM
I have the following query: SELECT Min(ID) as MinTransactionID, MIN(Batch) AS Batch, SUM(Qty) AS Qty, MIN(MachineID) AS MachineId, MIN(EngRev) AS EngRev, MIN(PartNum) AS PartNum, MIN(RecordTime) AS TimeProduced, 0 AS LabelRequired, 1 AS Summarize, MIN(LockID) AS Loc...more >>

using sysodbject to grab table names for more selects...
Posted by Jeremie D. at 12/11/2003 2:47:10 PM
Hi all, I have a very "newbie" question: I'm trying to make a quick sp that will read a specific set of table names from the dbo.sysobject ie: SELECT name FROM dbo.sysobjects WHERE name LIKE 'TMP_TOUPLOAD_%' and from there perform another select to look for nulls in a specific fie...more >>

Create temp table using resultset from a query??
Posted by Erik vonB at 12/11/2003 2:19:58 PM
I know this is possible, I just can't seem to get it to work. I want to take a table, query the rows from one column and invert it to create a temp table using those results as column names. Example: select typecode from mytable Typecode -------- ABC DEF GHI JKL Then using those...more >>

checking the existence of a #temporary tables.
Posted by I_AM_DON_AND_YOU? at 12/11/2003 2:19:48 PM
how do we check the existenc of a temporary table, e.g. create table #t (field1 int) insert into #t values (23) ----- i want to check the existence of table #t table, if it were a regular table e.g, thetable , i would have done as: if object_id('thetable') is not null drop t...more >>

Jobs
Posted by brian at 12/11/2003 2:18:53 PM
We recently changed from a domain to a workgroup. I have about 20 jobs that were created under the domain. Now they wont run because they can't determine if the domain which was the owner has rights to the server. Is there a way to change the job owners. I went into the sys tables an...more >>

Why does this limitation exist?
Posted by Darren at 12/11/2003 2:14:20 PM
Why is it that Inserted & Deleted tables cannot access ntext & Text fields. This is a serious limitation in triggers. Makes a simple task like creating an audit trail, a huge headache. Is there anyway around this? ...more >>

Query Plan
Posted by Subhash Agarwal at 12/11/2003 2:01:56 PM
Hi All, Is there a good article which guides in how to read query plans. What does Bookmark Lookup in a query plan means? Thanks, S ...more >>

Into Question
Posted by Darren at 12/11/2003 2:00:13 PM
Is there a way to have a table insert into another table only where the field names match? ...more >>

Tell If Database Is Online
Posted by rgondzur NO[at]SPAM NoSpamaicsoft.com at 12/11/2003 1:39:24 PM
I am writing a VB server that will query a SQL Server 2000 database for various data. The VB server will run on a separate box from the database server. Before I make any SQL queries, I want to test that the database is online and prevent making any SQL calls if it is offline. I do not consi...more >>

Count fields that aren't null across Record?
Posted by BEE at 12/11/2003 1:27:43 PM
This is the result I would like to have: RowID provid LastDate lastname firstname RecVal ------- ------- ----------- --------- ---------- ---- 201307 118498 2003-01-10 JOY NOEL 4 377532 118498 1973-12-11 NOEL JOY 5 RecVal says four fields are not ...more >>

append to where clause
Posted by TJS at 12/11/2003 1:22:49 PM
how can a variable string be appended to where clause when I try as below I keep getting a syntax error example: ------------------ CREATE PROCEDURE [dbo].[xxx] @Type integer AS Declare @string ... if @Type=1 set @string = "this" if @Type=2 set @string = "that" select ...more >>

Group by quarters
Posted by Darin Browne at 12/11/2003 1:22:00 PM
I have to group 2 years of data into 8 quarters (4 quarters per year). They want 8 columns of data returned with the data summed over the 2 year period. I can't figure out how to do the dates. Can anyone suggest a resource that would help understand how to accomplish this? Thanks....more >>

stored procedure insertion stop inconsistently
Posted by margaret.lui NO[at]SPAM sprint-canada.com at 12/11/2003 1:18:25 PM
Hi, We currently encourter a strange problem. Everytime, when we use ASP to call a stored procedure, the sp insert some records to a table. With same parameters, the number of records that's been inserted is not the same. The sp never finished the numbers of row it should insert to and there...more >>

table data type
Posted by Ann at 12/11/2003 12:51:15 PM
I have a sql table that has a column datatype smallint. In Access the same table same field we can format it as 0000, so that there are 4 digits, like 27 would be 0027. but SQL server table design view, I cannot find a format. How can I implement this in SQL server tables? Thanks ...more >>

Creating identity on an existing table
Posted by Non Sequitur at 12/11/2003 12:46:13 PM
I have an existing table that was, er, misdesigned. I need to retro-fit a bigint identity column (with auto-num). First, I added the column to the table as NULL-able. Now, of course, the column holds no data, so I can't just add the IDENTITY constraint. I need to number the existing rows and a...more >>

Good book to learn Stored Procedures
Posted by Bastian at 12/11/2003 12:39:46 PM
Hello, What=B4s the best book to learn SQL Server Stored Procedures? I have experience in DBMS. TIA, Bastian...more >>

sql programming question- appending string to select statement in query analyzer
Posted by Dhruv at 12/11/2003 11:44:00 AM
Hi, I have the following statement. I would like to replace part of a sql statement with a variable -@strDeptHead (that is a string which is built) where it says REPLACE HERE. However, I don't know how to make a string part of a select statement. Any insight would be great. Thanks Dhruv...more >>

Inserting multiple records
Posted by dave at 12/11/2003 11:35:49 AM
I have 4 tables sales, salesDetail, quote, quotedetail. I copied the 1 record from quote to sales and I got the @@identity. Not I have to copy multiple records from the quotedetail to salesDetail Here is the SP so far: CREATE Procedure addNonStock ( @tempQuoteID int ) As DECLAR...more >>

VSS & SQL2000 Integration
Posted by Makjalele at 12/11/2003 11:27:59 AM
I have a need integrating SQL2000 & VSS. Is there a simple way or any other way to do it? There are some undocumented procedures in SQL2000 which are to help one to integrate SQL database into VSS. Does anyone have documentation about those procedures? Or, is there a tool which makes it easyer? T...more >>

sp_OA extended stored procedures
Posted by Mario at 12/11/2003 11:25:18 AM
I want to use sp_OA extended stored procedures but I have an SQL Server 2000 and I did not find them in the stored procedures of the master table. Where they are supossed to be? Is there any way to add them to muy installation if they are not installed?...more >>

osql -- file output format
Posted by SQL Apprentice at 12/11/2003 10:59:34 AM
Hi, I am using OSQL to ouput a SELECT into a text file. C:\>osql -Ssql1 -E -dnorthwind -s -w100 -s" " -Q"set nocount on select employeeid, lastname, firstname from employees" -h-1 -otest.rpt 1 Davolio Nancy 2 Fuller Andrew 3 Lev...more >>

double record
Posted by LU at 12/11/2003 10:33:09 AM
So i should down load this free util to get it done and execute the command?...more >>

Windows Vs. SQL Auth
Posted by Michael L. at 12/11/2003 10:32:37 AM
Hi All, Just wondering, does Windows Authentication considered "faster"? Thanks! ...more >>

sql statement to format a number on import of data
Posted by Microsoft at 12/11/2003 10:16:55 AM
I am trying to use the statement below in SQL 7 to pad the import of a number to be a specified length. The parsing produces an error on the LEFT command. Any ideas on problems with this code? select {fn CONCAT(CMN_NUM, LEFT('00000000000', 11-LEN(CUSTOMER_NUMBER)) + CUSTOMER_NUMBER)} A...more >>

creating UPDATE triggers
Posted by Brad at 12/11/2003 10:01:35 AM
Hello, I'm trying to create a trigger that will update column X in row Y when column Z in row Y is updated. So far, I've only managed to create a trigger that updates column X in every row of the table when I update column Z in row Y, which is a bad thing. Does this require the use of a c...more >>

TempDB database.
Posted by I_AM_DON_AND_YOU? at 12/11/2003 9:41:54 AM
What's the use of TempDB database...just to store the temporary tables...... ? ...more >>

Search full field in view but return only part of field length in query
Posted by ms at 12/11/2003 9:25:52 AM
I have view in SQL 2000 that joins an Item Description (varchar) field from another view. The ItemDesc field's longest record is 257 chars long. I want users to be able to search on this entire field, from the ItemMasterView view, but only want to return the first 60 characters of the Item D...more >>

Insert Into and showing progress
Posted by kgs at 12/11/2003 9:17:42 AM
i have two tables t1 and t2 with identical structure. Iam copying records using truncate table t1 insert into t1(col1,col2,col3) select col1,col2,col3 from t2 t2 has two million rows. iam tracking progress of records are inserted into t1 using select count(*) from t1 form another dbconn...more >>

Transaction question
Posted by Woody Splawn at 12/11/2003 8:58:45 AM
I am new to SQLServer and SQL Server 2000, which I am using. Came from a Sybase environment. I am writing a stored procedure where a record is inserted into a table. The table has 80 fields in it. I want to insert a record and to put values in only 3 or 4 fields of the 80 field table. The t...more >>

Column names as variables
Posted by D Mack at 12/11/2003 8:36:05 AM
I want to send an email to our users when a change is made to their request in our maintenance management system. I am writing a trigger on the appropriate table in my database (customer) to collect certain data on update and write it to a new table (emailer). From that new table I will write a t...more >>

AND in an SQL
Posted by Charles at 12/11/2003 8:28:15 AM
I am trying to do run an SQL in VBA (through MS Access) and I wanted to know how to use an AND statement. I seem to be able to do it when I use an or statement but when I try and use an AND for the same exact thing I don't get any results. When I try to sue the query builder to do the...more >>

Return Formated date
Posted by Don Grover at 12/11/2003 8:26:11 AM
How can I return a qry as a string of date in format. 'Thu, 11 Dec 2003 17:00:00 +1100' This is date of qry + 3 hours +1100 is GMT offset for AU I have tried different ways but all seem to be inelegant, Hope some one can see an efficient way of doing it. Don ...more >>

Find all tables with a field
Posted by chris at 12/11/2003 7:51:16 AM
Hi All, I would like to get a list of all tables in a db that contains a specific field. I assume this can be found using the system tables but I can't find the appropriate tables. TIA, Chris...more >>

doule record should be one record
Posted by LU at 12/11/2003 7:36:12 AM
A class can have many instructor. I have an index table and one record for each instructor listed under a class. I do an inner join between the 3 tables to get the results, and i use the group function. Trying to this in a stored proc or sql query, no asp code When i run a query to sum ...more >>

Identity Seed
Posted by ChelleV at 12/11/2003 7:36:08 AM
I have a table that cannot be truncated because of foreign key relationships. This table has an identity seed field for the Primary key. Each night, I need to run a dts package to re-populate this table with current data. I use the "delete from tablename" statement with no where clause to delet...more >>

Query runs in query analyser but not in SQL Agent job
Posted by ed NO[at]SPAM ikosam.com at 12/11/2003 7:09:28 AM
The folloing query runs in query analyser, sends the mail and everything is fine. However if we run it as a agent job it completes everything apart from sending the mail using xp_sendmail. At the weekned we rolled this server out which has restored databases (except MASTER) of another SQL ser...more >>

store procedure
Posted by Silvana at 12/11/2003 7:06:20 AM
it is possibleto pass as parameter an array for one store procedure ? thanks, Silvana...more >>

SQL book recommendation
Posted by simon at 12/11/2003 7:04:11 AM
Hello All, I know basic SQL statements and stored procedures. Now I like to learn more advanced ANSI-SQL techniques. Can someone please recommend a good comprehensive book on such subject? Thank you very much. simon. ...more >>

dbcc shrinkfile
Posted by shaun at 12/11/2003 5:04:16 AM
Hi I have run this command will this cause any problems as I believe I should have specified a size..also is the tempdb that important..thanks for any answers USE tempdb GO DBCC SHRINKFILE (tempdev) GO ...more >>

Line Numbers in QA
Posted by Wayne Wengert at 12/11/2003 3:16:30 AM
Can anyone explain the line numbers shown in the error messages? They sure don't seem to match the code? BTW - I did fix the errors by changing dbl quotes to single quotes but I am still trying to figure out the QA line numbers. ---------------- errors --------------------- Server: Msg 1...more >>

Trigger on syscomments table to track stored procedure changes ?
Posted by Bob at 12/11/2003 1:56:09 AM
Is it possible to put a trigger on the syscomments table to save changes to stored procedures. Using this mechanism to create a version control log table ? Obviously putting a trigger on a system table, isn't the best idea always, but this is a dedicated development server, not the production...more >>

MS -SQL behaviour of INSERTED / DELETED tables --> very strange
Posted by Jeroen Kraij at 12/11/2003 1:27:29 AM
Hi All, We have an odd thing while using the DELETED and INSERTED- "tables"in triggers. If my collegue executes and SP in the Query Analizer, a query in a trigger takes a lot less when I execute the same SP. We think the difference is in the the usages of the DELETED and INSERTED-tab...more >>

Import & Export
Posted by Steve at 12/11/2003 12:40:54 AM
When I write: go select * into Staff3 from Staff2 where 1=2 go exec master..xp_cmdshell 'bcp master..staff2 out d:\cust.txt -c -t -S<server> -Usa -P"yahoo"'; I got the following error message: 1- The system cannot find the file specified. 2- NULL Where is the problem? what do [-c -t -...more >>

Inserting a column
Posted by David Mohandas at 12/11/2003 12:38:43 AM
How to insert a column in the middle of a table programatically without using enterprise manager and also without losing the data. Thanks, David ...more >>

Using BCP with Space in database name
Posted by JC at 12/11/2003 12:36:05 AM
Hi I want to create a batch file to execute a bcp, but I am having a problem since there is a space in my database name (for example: my DB). So when I execute the bcp, it inteprets "my" as the first argument and "DB" as the second argument The command is: bcp my DB.dbo.table1 in files.txt -fbcp...more >>


DevelopmentNow Blog