all groups > sql server programming > july 2005 > threads for friday july 22
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
Create Text Output File
Posted by Hoosbruin at 7/22/2005 9:19:35 PM
I have a SQL table defined like this.
Item Varchar(30)
Type Varchar(10)
Lang Char(2)
Page Char(1)
Comments Varchar(75)
Delimited data from the table
Abc,,US,1,Commnt1
Abcd,,US,1,Commnt2
Abcde,,US,1,Commnt3
Abcdef,,US,1,Commnt4
Abcdef,,US,1,Commnt4a
I need to produce a outp... more >>
Is there a better way to do this very simple query(s)?
Posted by Tom at 7/22/2005 5:23:02 PM
I' m almost certain that my approach is wrong but it works! Could someone
tell me the correct way to achieve the following?
--- Start Code ---
INSERT INTO
Categories (Description)
SELECT DISTINCT CategoryDescription
FROM Import
UPDATE Categories SET StatusID = 1
UPDATE Categories ... more >>
convert char to int
Posted by vickie k. hoffmann at 7/22/2005 3:13:08 PM
Hi all, Is there a function in SQL that will convert letters to numbers
corresponding to their placement in the alphabet?
For Example:
a = 1
b = 2
c = 3
d = 4
... ..
y = 25
z = 26
Thanks!
vickie
... more >>
Binary
Posted by Leila at 7/22/2005 1:04:48 PM
Hi,
I have a column that contains binary representation of numbers. For example
'10' for 2 and '11' for 3 and ...
I wanted to write a function to convert this column to INT but I thought
there might be a built-in function in SQL Server.
Are there any function?
Thanks in advance,
Leila
... more >>
Converting varchar to int
Posted by Star at 7/22/2005 12:11:36 PM
Hi,
I have a varchar(255) column where I may have data like this:
43294430949
adkk3400
1056
ff1d
10
302
15000043
I would like to write a SQL query that returns values between
10 and 500 (numeric)
If I just do this:
Select * from table where column between '10' and '500'
I would ... more >>
User Defined Function
Posted by Douglas Adams at 7/22/2005 12:10:13 PM
I have a database table that contains simply a point: '51.6899, -0.5547'
stored as a varchar
I want to supply the user defined function with a point of the same varchar
format: '51.6899, -0.5547'
and I am trying to get it to return the distance to that point. Using
simple trig.
cast... more >>
Table row counts different
Posted by Andre at 7/22/2005 11:16:04 AM
Can someone exlpain why you get different row counts in different places?
For example, when I double-click on a table in EM to display the properties
of the table and look at the Rows number, that is different than when I query
like select count(*) from table.... more >>
Reasons why DBCC INDEXDEFRAG would not work
Posted by Andre at 7/22/2005 11:14:01 AM
I am performing DBCC INDEXDEFRAG on my indexes in a table because I have
really bad extent scan fragmentation. After I run it though nothing has
seemingly changed. Can someone explain some reasons why this would be
happening?... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Comparing 2 PCs Inventory
Posted by FStuart at 7/22/2005 11:13:34 AM
I've decided to try another method to compare 2 PCs inventories via the
ADD Remove Displayname.
I have the following code I'm trying to use to compare the two and put
in the Netbios_Name0 column PTLSTANDARD if it is lacking that software
or the @name2 computer name if it exceeds the standard. ... more >>
tsql help
Posted by Neil Evans-Mudie at 7/22/2005 10:53:48 AM
Guys,
Using tsql (i.e. sql server)
I have a record like:
a b c
= = =
0.1 45.4 3.9E-2
I want to return a recordset like:
A a_scale b b_scale c c_scale
= ====== = ====== = =====
0.1 1 ... more >>
schedule dbcc indexdefrag every Saturday?
Posted by Mike at 7/22/2005 10:34:02 AM
How can I set up SQL Server to defragment all indexes on a weekly basis, e.g.
every saturday?... more >>
best way to keep a changelog
Posted by Allan Ebdrup at 7/22/2005 10:20:10 AM
I have a couple of tables where I want to keep a changelog of all changes
made to the table, There are of course different ways to acomplish this,
currently our suggesting is a table with oldValue, newValue columns, but
this is not very flexible when it comes to datatypes and many changes to t... more >>
SQL HELP
Posted by MS User at 7/22/2005 10:18:27 AM
I have a table 'TripMovement' with columns
CarID, TripType, TripDate, ....... (These three columns form the
PRIMARY-KEY)
Each trip will have an entry in table 'TripMovement' , there are
four different 'TripType' (A, B, C and D)
For a trip cycle, Trip will start with type 'A' - 'B' - 'C' an... more >>
insert/select
Posted by tshad at 7/22/2005 9:56:20 AM
I am trying to find an easier way to handle my insert/select statement. If
I have the following tables and query - Is there a way to do this in one
statement?
create table Master(
MasterKey int,
)
Create table SubTable1(
MasterKey int,
PK int,
Data varChar(1000)
)
Create ... more >>
unique id's
Posted by John at 7/22/2005 9:55:43 AM
I need to find the 10 most recent unique ids. Any help would be
appreciated.
The table structure is :
Create table temp (id int, dt datetime)
insert into temp
SELECT
424, '2005-04-04 16:29:00' UNION SELECT
408, '2005-02-25 11:12:00' UNION SELECT
167, '2005-02-23 16:51:00' UNION SELECT
4... more >>
Complex substring query and value conversion help...
Posted by trint at 7/22/2005 8:44:45 AM
Ok, I have to convert the dollar values of some of my fields in a
query, if the field to the left (in the left column) has a word that
part of the word has "debit" in it. Like this:
if(t5.description = "TransferDebit")
{
DECLARE @Num1 int
SET @Num1 = t6.amount
SELECT -@Num1
}
Thanks... more >>
Trigger Help
Posted by Eric at 7/22/2005 8:22:08 AM
Hi -
I'm trying to create an insert trigger on a table that will insert an
additional record on the same table. When an insert occurs on this table
(Trans), I want to check the value of a column ('type') and based on that
value, perform the insert.
Additionaly, I need the value of the ... more >>
readinf blob data in sql trigger
Posted by sathya at 7/22/2005 7:30:21 AM
hi,
i am using sql sever 2005 , i want to read binary data and data of
computed coloumn using trigger.
my table is below:
table column
------------
1) document data -- type (image)
2) userId --------- type(varchar computed column)
i have to write delete trigger which can get ima... more >>
INSTEAD OF INSERT TRIGGER AND NULL
Posted by Dr. Paul Caesar - CoullByte (UK) Limited at 7/22/2005 6:47:06 AM
Hi all,
I have created a INSTEAD OF INSERT TRIGGER but I seem to have a problem with
NULL values.
The trigger checks to see if a suppliers product code enetred is stockable
and if so gets the Item Description, Price Each based on Quantity and the VAT
Code. All 3 columns do not allow NULL... more >>
SQL Server and ASP EOF/BOF problem
Posted by Derek Fisher at 7/22/2005 5:22:02 AM
This is a half SQL Server and half ADO/ASP question. I have a web page that
displays a summary of records from a different table depending on what the
user selected. I have added a new table and my ASP page (which has worked
fine for 2 years) now displays an ADO error (EOF or BOF is true...)... more >>
osql in AD
Posted by Enric at 7/22/2005 5:20:02 AM
dear all,
"osql - l" works if there is an Active Directory?
Regards,... more >>
Most efficient way to query a remote server
Posted by Enric at 7/22/2005 4:58:03 AM
Dear all,
Using OPENQUERY or through of server.db.owner.table?
Regards,... more >>
Should I move the ntext field to another table
Posted by Craig HB at 7/22/2005 4:30:05 AM
I have an Orders table that includes an ntext field called "Notes". I am
considering moving that field into another table called OrderNotes that has a
1-to-1 relationship with the Order table.
The reason for this is that I am hoping that this could speed up querying
the Orders table, since... more >>
SQLServer 2005 enhancements
Posted by Relaxin at 7/22/2005 2:02:47 AM
I can't find a Microsoft list of everything that has been added to SS 2005,
but I wanted to know if a DATE and/or TIME datatype was added to SQLServer
2005?
Thanks
... more >>
Subquery Returned More Than 1 Value!
Posted by Arpan at 7/22/2005 1:24:30 AM
The following query, which retrieves the tenth costliest product from a
table, works fine:
---------------------------------------------
SELECT TOP 1 PID,PName,Price
FROM Products
WHERE PID NOT IN (SELECT TOP 9 PID FROM Products ORDER BY Price ASC)
-------------------------------------------... more >>
Passing result sets
Posted by Chan at 7/22/2005 1:02:02 AM
Hi All
I have to create a very generic procedure that can accept 2 data sets.
These data sets will typically be:
1) Lines of HTML code saved into a table for frequent use but having
variable fields which have to be replaced with data depending on the request
made to the database
2) Variabl... more >>
Dynamic SQL Question
Posted by ngorbunov NO[at]SPAM onetouchdirect-dot-com.no-spam.invalid at 7/22/2005 12:58:08 AM
I have to get a count of records using dynamic sql
I have the following and I'm getting errors (Syntax error convertin
the varchar value 'SELECT ' to a column of data type int.)
DECLARE @sCalldate varchar(10)
DECLARE @SQL varchar(8000
DECLARE @RC int
SELECT @sCalldate ='20050712
SELECT @sE... more >>
GROUP BY
Posted by James T. at 7/22/2005 12:13:35 AM
Hello!
I am using following dynamic stored procedure to return search results.
Evrything works fine... Now I would like to group results by IsFeatured
field, but I am receiving error message: "Column 'Table1.Id' is invalid in
the select list because it is not contained in either an aggregat... more >>
Merge replication
Posted by Pipo at 7/22/2005 12:00:00 AM
Hi,
I've spend a couple of days now trying to get the Merge replication working
on SQL server 2003.
I also searched the internet but it still doesnt work :-(
The SQL server help didnt help also.
(It says to look at samples but I dont have those on my machine...can I
maybe donwload those sa... more >>
Easy SQL Problem
Posted by Mark Thomson at 7/22/2005 12:00:00 AM
I have a simple table that stores
name score
------ -----
jim 343
bob 322
jane 122
I need a SQL query that will return the name and score of the person who has
the lowest score:
eg. jane 122
SELECT name, min(score) as score FROM tester group b... more >>
very strange SQL
Posted by Steve Drake at 7/22/2005 12:00:00 AM
All,
I have been tuning some SQL today, and i came across this problem.
I have these statements (these are done to reproduce my problem, the real
SQL is much bigger)
/* test one */
declare @parent varchar(254)
set @parent = '28CD626A-69B4-42C8-8576-3BF9294E6D70'
select * from fnumdet... more >>
copy a db, identity problem
Posted by Carlo at 7/22/2005 12:00:00 AM
hi
i need to copy a db to another db every single table to another similar to
the first one but with some difference. When i try to do that i need to
remove some constraint and all the identity on the new db. i'd like do that
with a script, i tried:
CREATE TABLE (
id int IDENTITY (1... more >>
SQL server does some strange things sometimes.
Posted by Michael C at 7/22/2005 12:00:00 AM
I can execute this statement and the view gets created. What suprised me was
the comment is also visible in enterprise manager. Once it gets the create
view statement does it go backwards and look for comments before hand also?
--example view called ABC
CREATE VIEW ABC AS
SELECT * FROM INFO... more >>
Aggregates
Posted by Mark Thomson at 7/22/2005 12:00:00 AM
I have a simple table that stores
name score
------ -----
jim 343
bob 322
jane 122
Lets say i have a user defined function that applys a formula to the score
and I want to select the minimum value of the function.
eg.
SELECT name, score, MIN(dbo.alte... more >>
how to determine a column is or not a identity column
Posted by Yuan at 7/22/2005 12:00:00 AM
I do need help now , Thanks for any help.
... more >>
|