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 2004 > threads for friday july 23

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

New to SQL and trying multiple table joins
Posted by Dave R. at 7/23/2004 7:30:07 PM
Unfortunately I have been thrust into the position of learning SQL for a new database we have implemented. I have very basic SQL knowledge, and can do some simple queries, but with the amount of tables I am working with it seems almost out of my scope. Here are the basics: I am working w...more >>


Querying a database
Posted by Ashish Nanda at 7/23/2004 7:15:17 PM
I have my table like this. The zip code column has zip code in 9 digits. Zipcode Code 056790000 A101 056800000 A101 056810000 A101 056820000 A101 056890000 A101 056900000 A102 056901111 A102 056901168 A103 056910000 A102 056920000 A102 ..... ...more >>

ansi_padding on/off difference
Posted by TomTom at 7/23/2004 6:48:02 PM
I am playing with ansi_padding setting in Query Analyzer. To me, the setting does not make any difference. I am changing the setting to on and off in the statement below. set ansi_padding off go drop table mytesttable create table mytesttable (lname nvarchar(50)) insert mytesttable values ...more >>

query help please...
Posted by roger at 7/23/2004 6:09:50 PM
Given a table that contains a column with sequential values, eg: create table #t (num int) insert into #t values (1) insert into #t values (2) insert into #t values (3) insert into #t values (4) insert into #t values (6) insert into #t values (7) insert into #t values (...more >>

Apply Monthly Charge
Posted by Jon Glazer at 7/23/2004 5:28:20 PM
Once I month I want to apply a charge in a register (a table) that basically containst Account Number, Charge Amount This is to facilitate a regular charged to a customer automatically, monthly. The amount to charge monthly is found in a table called Accounts Account Number, Monthly Ch...more >>

CHECKSUM >>> How to know on which columns the checksum got created
Posted by PVR at 7/23/2004 5:16:24 PM
Hello Sql Gurus, There is already a table in production with a checksum column computed. I know the particular column which holds the checksum. my question is how to know based on which columns the checksum got created. by using sp_help i am not getting on which columns the checksum ...more >>

Restore database rom different machine with query analyzer
Posted by Jochen Daum at 7/23/2004 3:54:16 PM
Hi, I would like to move/restore a database with the Query Analyzer. I always thought it was possible to do this with the backed up file sitting on the machine, where query anaylzer is sitting, but it doesn't seem to work. I try to hace a look into it by going restore HEADERONLY from ...more >>

Insert, Delete, and Update - best practices advice please
Posted by Mike Perry at 7/23/2004 3:44:53 PM
OK, having finally managed to arrive at my initial data table I need to update it as needed. There are two tables, one has, in part, the following schema: CREATE TABLE [growthinv] ( [Cust_Nbr] varchar (6) NULL, [Order_Nbr] varchar (6) NULL, [Entry_Date] datetime NULL, [Invoice_Nbr] varcha...more >>



autoindex in tables
Posted by Agnes at 7/23/2004 3:21:07 PM
in sql server, Can I set one column got is auto unquie index ??? e.g i got invoiceheader and invoicedetail , invoicedetail didn't got primary key indeed. how can i set it automically ?? Thanks From AGnes ...more >>

No Error, No Processing...
Posted by JDP NO[at]SPAM Work at 7/23/2004 12:52:07 PM
I'm not sure if I'm passing my "Return_Value" correctly, I had it as the last param in another proc and it failed, I moved it to the first param and that proc works. I execute the proc from the QA and it works w/out error. TIA JeffP..... Call Main() Sub Main() on error resume ne...more >>

Check current user permissions before running script
Posted by Chris at 7/23/2004 12:42:44 PM
We often run scripts. Within these scripts we always create the objects so they are owned by the DBO. These scripts are run automatically when our customers receives an update to our software. Sometimes the scripts fail because the user running the update does not have the required permissions...more >>

Removing multiple blanks in a string
Posted by Jonathan Blitz at 7/23/2004 11:50:45 AM
We need to prevent a user entring a string with multiple blanks between words. If the user does enter more than one blank we want to reduce it to one. I tried using the replace function in an "Instead of" trigger but that only works but that will only remove one pair at a time so if the user e...more >>

generate random sequence of numbers and letters
Posted by Rafael Chemtob at 7/23/2004 11:46:10 AM
hi, I need to generate a random sequence of numbers and letters that is no longer the 8 characters. How can I do that? rafael ...more >>

Select a Record By Number
Posted by PeterNunez at 7/23/2004 11:40:03 AM
I have the following query which returns a sorted list of 24 average values. I want to get the 12th record item. Is there a quick way to access that record by record number so I won't have to scroll thru using a cursor/fetch. DECLARE @Yesterday varchar(10) DECLARE @DayIncr tinyint SET @DayInc...more >>

How to select a result of a select
Posted by Carlos at 7/23/2004 11:19:27 AM
Ok I have a SQL that slect the DISTINTCS Dates of a table with a condition now I want to a new select of the original table only wih tthe dates I got form the first select how I do that SELECT DISTINCT TDate AS MyDate FROM (S WHERE (TSignal > 30) AND (TSteID = 1) ...more >>

Awaiting Command
Posted by Lontae Jones at 7/23/2004 11:14:02 AM
I have 10 severs that login to my database and after an sp_who2 I noticed all of them have Awaiting Command. Is this normal or reason why our front end app is not functioning?...more >>

Normalisation Query
Posted by student at 7/23/2004 11:07:49 AM
Suppose i have a table Employee eId eName eDept 01 xyz Sales 02 abc Finance 03 pqr Sales Normalization recommends there should be no duplicates as is this case 'Sales' Its better to have Employee eId eName dId 01 xyz d01 02 abc d02 03 pqr ...more >>

Select TOP dynamic...
Posted by Ricardo Corsi at 7/23/2004 11:07:27 AM
Hi, for you all! Well i need to Make the TOP command accept a query as a value... Like this: Select Top (select count(xxx) from bla where xxx) but i can´t do it. Any ideias ? Cya ...more >>

bulkadmin permission to a particular login name
Posted by PVR at 7/23/2004 11:03:39 AM
Hi Sql Gurus, How to add bulkadmin permission to a particular login name Thanks in Advance Regards PVR ...more >>

Views
Posted by CMC at 7/23/2004 10:58:01 AM
I have a view that sometimes when I query from, it mixes up the columns. For example, if I do: Select Name,Address from View it puts the Name in the Address column. This is the only view that this happens. My columns in the view are defined properly. thanks in advance. -CMC...more >>

Moving existing to a new filegroup
Posted by tt at 7/23/2004 10:48:00 AM
Hi All, I'm running sql2k. I have a 100 tables currently on the default PRIMARY group. Is there any way I can programingly move these tables to a new user-defined filegroup? Thanks, tom...more >>

DATAWAREHOUSE
Posted by MS User at 7/23/2004 10:41:36 AM
SQL 2K Some of the jobs in our datawarehouse box running more than expected time-frame. Please advice me , all the areas I have to look into for trouble shooting - including server setup.. Thanks In Advance MS USER ...more >>

Need Time Value output
Posted by Lontae Jones at 7/23/2004 10:31:03 AM
Hello, I have a column in my table HD2 called Starttime and its Data Type = float I am using DTS to export data from this table into an excel spreadsheet. Starttime is showing up in my spreadsheet like 34560.0. How can I get this to look like a time format. This is an example 4:34:03???? T...more >>

multi count
Posted by Jeff at 7/23/2004 10:07:15 AM
I need help in writing a statement with the following info. the field name i want to count is called country i want to count each country and display the totals of each.. in one statement.. i have the following countries: USA Canada UK Austrialia New Zealand Denmark ( and will add new c...more >>

Needed: a good MS-SQL book for Access users
Posted by Big Slim at 7/23/2004 10:00:51 AM
Can anyone here recommend a good read for an accomplished Access user (my client) to get familiar with MS-SQL? In particular, he will be training others to use Access as a (read-only) front-end reporting tool, so he will probably need a pretty good understanding of views and sprocs that call ...more >>

List of Connected Users
Posted by BRC at 7/23/2004 9:41:50 AM
I'm new to transact SQL and I need some assistance. I have an Access 2003 front end attached to a MS SQL 200 back end. I need to see who is connected to the SQL back end from Access. I see the SP_WHO command but I don't know how to access it from the Access front end. Any guidance from the e...more >>

SQL Restore from Tape
Posted by Nitin Rana at 7/23/2004 9:18:02 AM
Here is the situation. I backed up my SQL DB on local disk (D:\Temp\SQLDB.BAK). This backup file was further backed up on a DLT 4000 TAPE. I restored the backup file from the tape to the local disk and now when I try to restore SQL DB from the file which is originally restored from the Ta...more >>

Way to select certain columns from stored procedure
Posted by Shannon Broskie at 7/23/2004 9:11:11 AM
Hello, I'm using SQL Server 2000. I have a stored procedure that returns a resultset. Is there a way to perform a select DIRECTLY on that resultset in SQL? Example: -- MarketValue is one of the columns returned by the stored procedure -- SELECT MarketValue FROM (spGetHoldings(@Accou...more >>

exec('create table... with dynamic table name
Posted by Alexander Jagl at 7/23/2004 8:47:06 AM
Hi! I'm trying to create 1 to n #Tables with dynamic sql in a stored procedure. exec ('create table ' + @Tablename + ' (.....') I found out that this table only exists within the exec-statement but I need the #Table in the stored procedure. Is there another way to create tables with dynami...more >>

select record number and all fields in a table
Posted by Amy at 7/23/2004 8:06:05 AM
Hi, How can I do to select record number and all other fields in a table. For example there are employeeid, lastname, and firstname in employee table. The data in table like this employeeid lastname firstname 12-345 L1 F1 23-456 L2 F2 3...more >>

writing a Delete trigger on a table for cascading effect
Posted by Rodger at 7/23/2004 6:30:02 AM
Hi Guys I want to write a delete trigger on a table which will delete rows on a second table, I have written triggers for insert and update but not tried delete, would appreciate if somebody can give me a small sample code for any two tables. for delete operation Thanks ...more >>

Syntax error when using sp_executesql
Posted by (karditsi NO[at]SPAM csd.uoc.gr) at 7/23/2004 6:01:55 AM
I have the following store procedure: CREATE PROCEDURE [DBO].[SP_TEST] @CNCODE INT,@TAMCODE INT AS DECLARE @MYQUERY NVARCHAR(1000) DECLARE @PATCODE BIGINT DECLARE @PARAM NVARCHAR(20) DECLARE @VALUES NVARCHAR(20) DECLARE @PATENTRYNR INT SET @PATCODE = 100100031 SET @PATENTRYNR = 17...more >>

c++ ole DB stack overflow during sql server compilation
Posted by mmike74 NO[at]SPAM caramail.com at 7/23/2004 5:44:46 AM
hi, when i execute : CCommand<CManualAccessor, CBulkRowset, CNoMultipleResults> rs; rs.SetRows(100); HRESULT code_resultat = rs.Open(session, requete, &propset, NULL, DBGUID_DBSQL, FALSE); with a requete with length = 13000, it works perfectly but when my requete length is 200000 (exam...more >>

AUTOSTART
Posted by Karl at 7/23/2004 5:42:26 AM
When I set up my SQL Servers I ALWAYS check "Autostart SQL Server Agent" in Properties/General tab. Yet, some of my servers (it is always the same ones) fail to perform the autostart when SQL is stopped/started or the server is rebooted. Does this sound familiar to anyone? How can I fix...more >>

learning SQL Profiler
Posted by Ed at 7/23/2004 5:35:26 AM
could be a dumb question but is there a book or web site or white paper that is dedicated to teaching how to use sql profiler? I have no experience with it and want to use it. Ed...more >>

Object creation not appearing in consequent log backup
Posted by tram_e NO[at]SPAM hotmail.com at 7/23/2004 5:12:27 AM
Hi, Our db is full recovery mode. I've done full backup and few log backups. Then created the table through EM. Refresh the DB in EM and did the log backup. When I restored this log in standby , I am not getiing the new table. Same with drop table. It is taking some time to getinto log backup...more >>

select TEXT field
Posted by hngo01 NO[at]SPAM hotmail.com at 7/23/2004 4:29:27 AM
Hi! I have table and there is a field with datatype is text. when I select that field in SQL analyzer, I don't see all the context. Any any ideas? This field has about 7000 characters now. Thanks...more >>

Inserting Multiple Records
Posted by Stephen at 7/23/2004 4:12:02 AM
I am writing script to populate tables in a database like this: - INSERT INTO Recommendation (Notes, MadeBy, [Date], [Delete]) VALUES('explosive case be careful', 'Stephen Cairns', '15/06/2004', '0') This is fine but it is only allowing me to insert one record. Is there any way to insert mul...more >>

Generating a Unique number
Posted by Peter Newman at 7/23/2004 4:00:02 AM
I have a table containging Client Licence numbers and System PIN numbers Licence Varchar(6) UNIQUE PIN Varchar(6) Licence PIN 217212 225684 217514 329957 How can i generate a 6 digit PIN number that has NOT already been used?...more >>

Violation of UNIQUE KEY constraint
Posted by Stephen at 7/23/2004 3:28:01 AM
I am getting an error running the following two insert statements in a stored procedure and im not sure what exactly i've went wrong. The sp and error message when run are as follows: - CREATE PROCEDURE dbo.sp_OutstandingEvidence AS INSERT INTO OutstandingEvidence ( Comment) VALUES ( 'a c...more >>

Query building tool
Posted by James Autry at 7/23/2004 3:05:47 AM
What is a good query building tool for the average user without SQL experience. Need something that the average user can do searches on existing data. Thanks, ...more >>

importing omnis data file into sql server2000
Posted by mak at 7/23/2004 2:19:04 AM
hi. how to import omnis data file(.df1) into sql server2000.any help on this. ...more >>

attach only ndf datafile
Posted by jsvoboda NO[at]SPAM lekis.cz at 7/23/2004 1:08:01 AM
We have a big problem. After crash the server we have only .ndf datafile and we need restore this datafile to other sql server.How make it?...more >>

Syntax error of a select statement
Posted by (karditsi NO[at]SPAM csd.uoc.gr) at 7/23/2004 12:52:51 AM
I have the following store procedure: CREATE PROCEDURE [DBO].[SP_TEST] @CNCODE INT,@TAMCODE INT AS DECLARE @MYQUERY NVARCHAR(1000) DECLARE @PATCODE BIGINT SET @PATCODE = 100100031 SELECT @MYQUERY = COLA FROM ASFEXCELSTMTS WHERE CNCODE = @CNCODE AND TAMCODE = @TAMCODE PRINT @...more >>

Tool to script out SPs
Posted by SPhan at 7/23/2004 12:26:15 AM
Can anyone suggest a good tool that can script out all the SP/Views/Functions etc. and create a separate text file for each. We were relying on the EM but that has issues and it truncates the files names etc. ...more >>


DevelopmentNow Blog