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 > january 2004 > threads for friday january 9

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

odbc vs oledb
Posted by kevin at 1/9/2004 10:59:04 PM
Hi Guys, I am new to database world. I have a question. what is the diff. between oDBC and OLEDB and which one I should use and why? Thanks a lot. ...more >>


I know one with dtsrun and EM.
Posted by shandy at 1/9/2004 10:56:42 PM
What are the diff. ways a DTS package can be executed. TIA. ...more >>

Stored procedures and permissions
Posted by David at 1/9/2004 7:37:19 PM
We have a situation where a 'wrapper' stored procedure calls another in a separate database. Is it somehow possible to set permissions on the wrapper stored procedure so that it always executes as a particular user, regardless of who actually calls it? ...more >>

Update a date field from a nvarchar field
Posted by JB at 1/9/2004 7:01:14 PM
How do I update a date field in table a with data from a nvchar in table b. Field in table b is stored as 20040109 Thanks JB...more >>

records occurring in relative time window
Posted by Daniel Rosenthal at 1/9/2004 6:04:25 PM
I am searching a table of about 500,000,000 records. name event date I want a list of names where given events occurred within a given time window, relative to each other (i.e. within 1 week of each other). To find a list of names who had ALL events A, B, and C, I join the table on its...more >>

Case Else help
Posted by Patrick at 1/9/2004 5:11:12 PM
I'm just learning SQL Queries so be gentle. I'm trying to generate a query to produce mailing labels, using the following conditions: 1. Check YesForMail(boolean) for y/n if client accepts mail. If yes, proceed to step 2, if no, skip record? 2. Check table for alternate mailing addr...more >>

Retrieve information
Posted by Flor at 1/9/2004 4:29:12 PM
Is it possible to retrieve information using a sql statement from one SQL Server to another. Example retrieving information from table employees located in server B but running the sql from server A. Is this possible Thank you very much in advance for the answer Flor ...more >>

SQL
Posted by Rafael at 1/9/2004 4:10:57 PM
do is possible to create an SQl Statement to access the tables from another sql server. Or to retrive data from DB A (from server A ) import into DB B ( server B). Best Regards Rafael...more >>



Parameters for Ad Hoc Reports
Posted by Craig Somberg at 1/9/2004 3:26:18 PM
SQL2000 WIN2K Thanks for looking at this thread. Here is the deal I have a report that allows users to query a database with up to 10 parameters. The issue is most of the parameters are never used yet in my sql, I am setting up conditions to use them. I know I can create a sp to handle the ...more >>

passing variables to column names in select stament
Posted by martino rivaplata at 1/9/2004 2:55:51 PM
Hello, I have a table with columns "Net Posting 01", "Net Posting 02, so forth thru "Net Posting 12" which contains dollar figures. Is it possible to declare a variable,let's say, @count char(2) inititate it with value @count='01' then pass this variable value to a select statement as...more >>

Loop
Posted by Ruslan Shlain at 1/9/2004 2:46:13 PM
I have a table that has following structure Name Type Total There are 2 types of totals for each employee. What i need to do it to create a temp table that whould have following structure Name Total1 Total2 Please help ...more >>

meaning of "declarative"
Posted by haode at 1/9/2004 2:42:41 PM
in the phrase "declarative data integrity" What does "declarative" mean? in general, when you describe something as declarative something, what does that mean? TIA. ...more >>

Char auto generate
Posted by Jabu at 1/9/2004 2:31:18 PM
I am trying to auto generate a char column with the following format: LV000001 LV000002 LV000003 ..... I know how to do this if the column is type int (you would use the "Identity Seed" and "Identity Increment" properties), is there a way to do this with a type char using the above format....more >>

Automated Query Problem
Posted by Ben at 1/9/2004 2:27:47 PM
I need a query that will have the logic to increment settlement_batch_number by one. I need the settlement_batch_number field to be incremented by one daily not literally only in the query so I can use the SELECT statement for the incremented value. I have left some values out for security...more >>

Setting up default values from the passed value
Posted by William Enloe at 1/9/2004 2:24:28 PM
Please see the sample code below to follow question. How can I allow a default value be set by another inputted value within a stored procedure? Create Procedure PROC_build_file @var_1 varchar(3), @var_2 varchar(18) = @variable_1 + '_other_Standard' AS If Left(@var_2, 3) ...more >>

Data Type Verification
Posted by robinsoh NO[at]SPAM vu.union.edu at 1/9/2004 2:04:19 PM
Hello, I have a table which has a column called "data" of type nvarchar and another column called "data_type" of type int. Basicly the "type" column is an enumeration value that specifies how to interperate the text inside the "data" column, i.e. as an int, real, datetime, etc. Somewhere down t...more >>

rand function within cursor
Posted by Rob at 1/9/2004 1:50:03 PM
My apologise if this post shows up twice. Trying to populate a password field for existing records in a table. The code below looks fine to me, but, when ran, it doesn't complete. Any help is appreciated. Thanks, Rob declare @letters char(36), @passwd varchar(8), @i int, @j int ...more >>

Set Ansi_Nulls on in stored procedure
Posted by Cornmen at 1/9/2004 1:21:53 PM
Hello, I'm creating a stored procedure in which I need the ansi_nulls set to on for it to work. Is there a way to set this in the stored procedure? I've tried the following set ansi_nulls on go but everything after go gets deleted when I save the stored procedure. Thanks, Mike ...more >>

SELECT statement
Posted by simon at 1/9/2004 1:17:30 PM
I have select like this: SELECT T3.izd_id,max(T3.vsotaKolicine)as vsotaKolicine,T3.izd_naziv_Ang,T3.kolicinaZaloga, T3.datum , narKol=(SELECT top 1 narKol=sum(n2.nar_kolicina),rokDobave=rok_dobave FROM (select nar_id,izd_id,max(datum_spremembe)as datumSpremembe FROM narociloIzdelek GROUP BY n...more >>

rand() within fetch
Posted by rob at 1/9/2004 1:16:44 PM
Hello All, Any ideas why this isn't working? Trying to get a 6 character password generated for each record in a table. Thanks in advance, Rob declare @gaitnumb as char(40), @letters char(36), @passwd varchar(8), @i int, @j int select @Letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789...more >>

query question
Posted by Mike Kanski at 1/9/2004 1:08:22 PM
I have the following table: Fruit | Sequence ------------------------ Orange | 1 Orange | 2 Apple | 1 Apple | 2 I need to write a query that will return Distinct Fruit that has max(sequence) So if i'd run this query on the table...more >>

selecting fields using its ordinal position
Posted by Fidel Ramirez L. at 1/9/2004 1:07:43 PM
how can i select a field using its ordinal position in table. usually i do this in vb(ado), no problem, but in a sp?. thanks in advance. Fidel R.L. ...more >>

loop thru table multiple selects/inserts
Posted by martino rivaplata at 1/9/2004 12:57:57 PM
Hello There How can i automate this repetitive select/insert from Table AGC_NOV into TBLFACTFINANCE. So i do not have to rewrite/run twelve times the same SQL statements. Basically this is what I have to do: INSERT INTO [tblFACTFinance] (Account,Category,Entity,RptCurrency, SIGNE...more >>

Alerts - Low Power - How to
Posted by Gerard at 1/9/2004 12:44:33 PM
Does anyone have any ideas on how I go about setting up an alert for a Low Power situation. I am using an UPS with USB connectivity. I am running SQL Server 2000 SP3a on Windows 2000 Server. Thanks in advance for any help. Gerard...more >>

Question about 'Order by [Date]'
Posted by Hwak at 1/9/2004 12:28:19 PM
Hi, All I have a question about how to order the query. There are two columns' type are Datetime and named Eff_Date and Fin_date. I want to show the query in this order, show the Fin_date is Null first, then the Fin_date is not null. Also, the Eff_date should be in desc order I try lik...more >>

RE:Alter Column Ordinal Position
Posted by rikesh at 1/9/2004 12:17:12 PM
Hi Is it possible to change the column Ordinal position within a table via script? -- Kind Regards Rikesh (SQL2K-SP3/W2K-SP4) ...more >>

Strip Crlf from Text column
Posted by T. at 1/9/2004 11:26:06 AM
hi all, is there an easy way to replace chars within a text (blob) column without resorting to TEXTPTR, READTEXT,UPDATETEXT,etc. Is there something akin to REPLACE(,,)? I know I can CAST a text col to varchar but it will be truncated to 8000 chars. Thanks for any thoughts ...more >>

How to Eliminate duplicate identical rows.
Posted by oracle901 NO[at]SPAM yahoo.com at 1/9/2004 11:24:16 AM
Question. Eliminating duplicate identical rows. --1. assume we have this table create table T ( tabid int not null, crdate datetime not null ) go --2.Now load the following data: insert into T values (1, '1/1/2003') insert into T values (1, '1/1/2003') insert into T values (...more >>

XP_CMDSHELL and variables
Posted by William Enloe at 1/9/2004 10:40:56 AM
Does anyone know how to set up xp_cmdshell to use variable names within a procedure? I have declared and set DOS statements within a procedure, but when I attempt execute xp_cmdshell using the variable the statement errors out. (See sample code below) --start TSQL declare @dos_statement varc...more >>

Select nearby locations using Lat / Long
Posted by Damien Laffan at 1/9/2004 10:38:41 AM
-- Microsoft SQL Server 7.00 - 7.00.1063 (Intel X86)=20 -- Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 3) I have found many posts providing methods to return the distance between = two points, however I have not been successful in finding any methods to = convert these func...more >>

Test, please ignore, do not use email for spam
Posted by bilbo baggins at 1/9/2004 10:37:06 AM
Please ignore, this is a test ...more >>

large string data type
Posted by woodysapsucker at 1/9/2004 10:36:41 AM
Hi, I am using t-sql and need to concatenate string data into a very long string (possibly up to 31,500 characters - it will vary). I haven't been able to find a string data type in t-sql that supports a variable of this size. I will be inserting this data into a column in a table of type text...more >>

Stored Procedures
Posted by Bob Slattery at 1/9/2004 10:31:56 AM
How do you call a sp from ADO? Thanks In Advance pp ...more >>

SQL Query
Posted by Bob Slattery at 1/9/2004 10:30:04 AM
What does the term coelesce mean? Sincerely, Thanks ...more >>

select row counts
Posted by culam at 1/9/2004 10:20:23 AM
Hi, My query return number of rows; and I would like to select row count for each run. Example: Query result: Cnt cnt 1 2 2 3 5 Desired result: 2 3 Thanks, Culam ...more >>

Update to table that contains a trigger
Posted by Gerald at 1/9/2004 10:05:10 AM
I need to update a table that contains a Trigger For Update on it. Do I have to drop the Trigger before running my Update or is there a way to ignore the trigger using a SQL command? Thanks in advance....more >>

Character(25) to Integer
Posted by kurt sune at 1/9/2004 9:30:24 AM
Does anyone have a smart idea? I have tables having primary keys with (among other columns) a column declared as char(25). I need to select data from these tables in different resultsets and send these resultsets to Crystal Reports. And CrystalReports can only join on numeric columns. So...more >>

Log Shipping Resync
Posted by William Enloe at 1/9/2004 9:24:52 AM
Does anyone know how to reset or resync the Log Shipping Transaction on the Standby Server? I am in testing mode and ran a backup log dbname with truncate_only and it caused my log shipping mechanism to fail and now I need to know how to resync the process without having to Re-implement the...more >>

Deleting Duplicates when field value is NULL
Posted by mamun_ah NO[at]SPAM hotmail.com at 1/9/2004 9:19:33 AM
Dear All, I need to delete duplicate records in a table based on 3 fields (ClaimNumber, ClaimDate, and ProcCycle). I am using the following codes (got from this newsgroup) to delete duplicates from tables. However, it does not delete if one of the fields value is null. For ex. in many cases t...more >>

Update field on a table that has a trigger
Posted by Gerald at 1/9/2004 9:06:45 AM
I've searched the newsgroup for this issue but couldn't find a match even though I'm sure this is a basic question for most of you. What I have is a table that contains a Trigger For Update on it. I need to update a field on this table with a SQL statement and need to know if I must drop ...more >>

Need to read a NTFS Directory
Posted by Renny at 1/9/2004 8:36:14 AM
Need Help. Need a procedure (SQL Server 2000 ) to read from NTFS Directory and take file names and insert in a table. Thanks Best Regards...more >>

Export entire database to Flat file
Posted by RR at 1/9/2004 8:26:31 AM
Hi Guys, How do you export an entire database into a flat file in SQL server? Is it possible?...more >>

Decimal Modulus
Posted by Nick at 1/9/2004 8:26:21 AM
How do i get the mod of two decimal numbers?...more >>

xp_cmdshell
Posted by Kelly at 1/9/2004 8:05:37 AM
I get an error at the end of this code. This is a partial sample of what I'm doing. Basically after derterming what the @backupname is (based on today's date) I need to find out what @backupname would be 2 days ago. I've done that but can't get the code staight for xp_cmdshell to test the ...more >>

Inserts and updates
Posted by martino rivaplata at 1/9/2004 8:05:10 AM
Hello, I was trying to automate this repetitive select/insert from Table two into TableOne. So i do not have to rewrite twelve times the same SQL statements. Basically what i am trying to do is: INSERT INTO TableOne (Account,Category,Entity,RptCurrency, SIGNEDDATA ,Dept,TimeID) SEL...more >>

Primary Key Column_Name
Posted by Don at 1/9/2004 7:58:52 AM
How do you obtain the Primary Key name that corresponds to the Column Name? I created the SQL statement listed below, but it does not always return the Column Name that corresponds to the Primary Key. Example: PK__CPX_CustomerCompty__6C56D5A2 PK__CPX_SalesAreaRegion__720FAE...more >>

where are user defined parameters are stored in MS SQL Server?
Posted by Bing Du at 1/9/2004 7:51:10 AM
Greetings I'm new to SQL server. We're running SQL Server 2000. The user interface is written in ASP. I'm trying to find out where the parameters that a comercial application software sets up and uses in the SQL Server 2000. This application software reads an plain text input file which define...more >>

3 GB Switch
Posted by JI at 1/9/2004 6:48:41 AM
If I have a server with 4GB of RAM and I am running SQL Server 2k Standard edition (which support up to 2GB of RAM) does it help anything to utilize the 3 GB switch....more >>

statistics that start with _wa
Posted by blarfoc NO[at]SPAM yahoo.com at 1/9/2004 6:09:22 AM
i see many statistics in my database that start with _wa. i know sql server has created these for me. my question is, did sql server create them because i did something wrong with my indexes? if my indexes are designed perfect then would i have any statistics that start with _wa? should i cr...more >>

Starting Over
Posted by LetsGetItStraight at 1/9/2004 5:57:26 AM
When I first setup my SQL Server I didn't really understand what I was doing. As a result, I made some poor choices. I HAVE to expose my server to the internet but even so 1. I set up my server to use 1433 port. It was the default listed so I didn't argue. 2. I used a seperate username...more >>

Between a between
Posted by Stijn Verrept at 1/9/2004 2:26:12 AM
I have this table: CREATE TABLE [dbo].[Test] ( [TE_ID] [int] NOT NULL , [TE_Begin] [smalldatetime] NOT NULL , [TE_End] [smalldatetime] NOT NULL ) ON [PRIMARY] GO With this sample data: INSERT INTO [Test] ([TE_ID],[TE_Begin],[TE_End])VALUES(1,'Sep 4 2003 12:00:00:000AM','Sep 13 20...more >>

Problem of server
Posted by Shal at 1/9/2004 1:27:30 AM
Dear Friends I am getting the following error. Server: Msg 7411, Level 16, State 1, Procedure GEMSAL, Line 3 Server 'Coolcat' is not configured for DATA ACCESS. For the following create view statement. CREATE VIEW dbo.GEMSAL AS SELECT GeminiMainSQL.dbo.GEMSAL.* FROM co...more >>

Copy data from one table to another
Posted by AndrewM at 1/9/2004 12:47:51 AM
Hello, I have two databases with identical tables in each. I need to take the data from one of the tables and populate the identical table in the second database. Please can anyone help me with a method. Thanks, Andrew. ...more >>

SQL Server Randomly deleting relationships
Posted by Norman McFarlane at 1/9/2004 12:04:36 AM
Hi everybody, Hopefully this is the right ng for this. If not, please point me at the right one. We have a db wtih about 140 tables. It is an ERP solution for a paper merchant. We have discovered that SQL Server is randomly deleting referential integrity realtionships. We discovered this w...more >>


DevelopmentNow Blog