all groups > sql server programming > september 2004 > threads for saturday september 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
truncate existing values and insert into another column
Posted by pk at 9/11/2004 11:11:02 PM
Table_A, Field_1 (varchar, 15), Field_2 (varchar, 15, null possible)
sample data for Field_1 :
aa6xxxxxxxxxxxx (len is 15char)
aa8xxxxxxxxxxxx (len is 15char)
If 3rd char is 6, truncate the data, keep only the 1st 6 char from the
right, and insert this truncated data into Field_2
If... more >>
Trying to avoid using a cursor....
Posted by TomT at 9/11/2004 10:25:02 PM
I'm trying to update a column in a table, and as recommended by so many, do
it without resorting to a cursor.
The situation is more complex than what I am presenting here, but if someone
can show me a way to get the simplified version working I can go from there.
E.g., I have a table with ... more >>
SQL- Calculated Field
Posted by Cady Steldyn at 9/11/2004 9:51:34 PM
SQL- Calculated Field
Example:
Date | ItemCode | Stock_In_qty | Stock_Out_qty | Bal_qty
------------------------------------------------------------------
12/09/2003 | A100 | 20 | 0 | 20
25/10/2003 | A100 | 0 | 10 | *10
I need to que... more >>
How to query database with multiple queries
Posted by Cady Steldyn at 9/11/2004 9:41:28 PM
I have the following fieldname in an Access_Table:
Field 1 = Cust_ID (Primary key)
Field 2 = Date
Field 3 = Description
Field 4 = Inv_No
Field 5 = Amount
My SQL Input syntax are:
"Select distinct Cust_ID,Date,Description,Inv_No,Amount from
Access_Table WHERE Date <Now()-30 And Date >... more >>
SELECT IN statement question
Posted by Martin A. Weinberger at 9/11/2004 7:43:15 PM
Hi All,
I have a column in a table that is character based. I defined the column as
varChar and 256 characters. Each of the strings is null terminated, but even
if they weren't, how would I do a search using IN to grab a portion. For
instance,
FIELD_CITY
Los Angeles
New York
Dallas / For... more >>
Best way to detemine default data directory from TSQL?
Posted by Jon at 9/11/2004 6:38:40 PM
How can I quickly determine the current default directory for an instance of
SQL server from TSQL? I searched and searched for a system variable or sp
that would do such a thing but with no luck. The only thing that I've been
able to come up with is to use XP_CMDSHELL to run REG QUERY and parse t... more >>
Date Conversion Question
Posted by John A Kushwarra at 9/11/2004 6:05:02 PM
Given a year, week and day I need to convert that to a date. Any help would
be greatly appreciated... more >>
Insert/Update query
Posted by Jimmy Morgan at 9/11/2004 5:41:22 PM
Is there a statment that if an old record in the table has
the same value as a new record for a PRIMARY KEY or a
UNIQUE index, the old record is deleted before the new
record is inserted such as the REPLACE statement in mySQL?... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Advanced SQL query
Posted by Shay at 9/11/2004 5:29:14 PM
Lets say that I have a table with 2 columns: User name, Item
I would like to make a query that will give as a result for each user name
the number of item that it has, order by number of items.
Is it possible to do with SQL query?
Thank you in advanced
... more >>
How to efficiently return the last order for all customers
Posted by Andrew at 9/11/2004 5:19:02 PM
Can someone help me improve the performance of the following query. I am
running this query from Access via ODBC connection to FoxPro data tables.
I am trying to return a list of the all customers and their last order.
SELECT Customers.CustomerID,
(SELECT TOP 1 OrderID FROM Orders ... more >>
should we use a quote for int type?
Posted by Matt at 9/11/2004 5:16:48 PM
If the data type is int, we can use quote or without quote to represent the
value
For example, the following will work, so we can use either one??
SELECT * FROM STUDENT WHERE ID='1001'
SELECT * FROM STUDENT WHERE ID=1001
However, if the data type is string, then we need to use quote to re... more >>
0 removes before decimal
Posted by amish m shah at 9/11/2004 4:28:42 PM
Hi all gurus
When I run a query
Select 0.25 + 0.25 it gives me .50 , 0 is omited from the result and result
starts from decimal sign.
But I need it should be 0.50 , means 0 should be displayed before decimal
How can I do it?
--
Thank and Regards
Amish M Shah
... more >>
Data archiving
Posted by Johny at 9/11/2004 2:06:57 PM
I have to archive data from SQL server (only part of database).
My idea is that I use ADO and simply save data and later load that data
using some methods of ADO components.
Does anybody maybe have some better idea?
Since I will have several files I want to aggregate this files in one, can
an... more >>
Subquery Problem
Posted by Scott at 9/11/2004 1:35:34 PM
DDL included . I'm trying to return Team Name, etc. from a t_teams table
that has some simple joins. FIGURE 1 does this fine and even return the
userID of any user that is a team leader (t_teammembers.teamTypeID = 1). My
problem is getting the First and Last name of the user that is a leader.
Wh... more >>
store procedure with 'condition'
Posted by Agnes at 9/11/2004 1:25:34 PM
My code is list as following, Can I set the condition which accord to 'input
parameter' ??
Thanks
CREATE PROCEDURE dbo.companyinfo_company_list
@searchcondition varchar(30)
AS
select cocode,coname
from companyinfo where
case @searchcondition
when 'SHIPPER' then companytype ='CUSTOMER... more >>
How to find the name of the calling EXE name
Posted by Justin at 9/11/2004 11:17:40 AM
I have two different .NET windows application, both calls the same database.
A stored procedure inside this database should know the name of the calling
..net application, and execute a business logic based on its value. I tried
to use the built-in APP_NAME function, but it returns ".net Sql dat... more >>
INSERTED... UPDATED?
Posted by niv at 9/11/2004 10:49:45 AM
Hello,
How can i determine the row that is being updated in a
trigger.
I know I can do this
SELECT * FROM INSERTED
but can i do this>
SELECT * FROM UPDATED... more >>
Is is possible to insert a column with a specific ordinal index?
Posted by Laser Lu at 9/11/2004 7:31:04 AM
Hi, all, my question is how to insert a column at a specific ordinal
position, by using TSQL. Is that possible?... more >>
Adding backup jobs to MSDE
Posted by John at 9/11/2004 4:11:04 AM
Is it possible to add backup jobs to an MSDE only installation. I realize
there is third party software that will give a you a GUI interface to manage
an MSDE server, but I'd rather not have to distribute another piece of
software.... more >>
Need help to validate column data
Posted by Bhaskar at 9/11/2004 3:29:53 AM
Hi,
i have a temp table which is having one Comments column.
I need to validate the this comments column for invalid
characters.
Before inserting this data into a real table, i need to
validate this column. Valid characters for this column
are [a-z],[A-z] and [0-9], _, spcae and -.
I... more >>
|