all groups > sql server programming > april 2006 > threads for friday april 7
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
Insert / Update Statement
Posted by Nizham at 4/7/2006 10:24:14 PM
Hi
The table have the row as
A, 1, 5
B, 10, 13
I need to insert the vales to other table as
A, 1
A, 2
A, 3
A, 4
A, 5
B, 10
B, 11
B, 12
B, 13
Waiting for a reply
Thanks in advance
Nizham
Following is the DDL
declare @Test1 table
(
Code Char(1),
FromNo int,
ToNo i... more >>
User Define Database
Posted by Naana via SQLMonster.com at 4/7/2006 7:55:12 PM
Hi All,
I need a script that will give table names, number of rows, szie of data and
indexes, clustered or non-clustered, and filegroup name.
Can any one point me to the right direction.
Thanks.
--
Message posted via http://www.sqlmonster.com... more >>
Vbscript in a stored procedure
Posted by Zrod at 4/7/2006 6:50:13 PM
hi,
IS there a way to write vbscript , or call an execultable within a stored
procedure?
... more >>
Archiving data to a seperate database.
Posted by MarkieMark at 4/7/2006 6:43:48 PM
Hi all,
Would appreciate some thoughts on the best way to do this scenario.
This is not a large database in the number of tables, but has about 100,000
new rows per day. Data is inserted only, and no queries / SPs are being run
against the data.
Database 1 (transactional database)
Holds al... more >>
getdate() format problem
Posted by Michael at 4/7/2006 4:50:02 PM
Hello,
I am just trying to do a simple time stamp. When I do the following SQL
command
SELECT getdate() my book and Microsoft say I should get the format like this:
3/22/2002 6:08:08 AM
Instead when I run this I get the following format:
2006-04-07 18:37:19.823
How do I get i... more >>
Query to display a field based on a parameter
Posted by KatMagic at 4/7/2006 4:29:47 PM
I have a client table, with 8 fields, all of which contain a phone number.
Bad design, I know, but let's not get into that here. My problem now is
that in addition to those fields, we have a "Preferred" field, which simply
names the field of the preferred phone number. So we have fields like... more >>
Compairing Date Ranges with time
Posted by LvBohemian at 4/7/2006 3:43:02 PM
I am considering the following snippet to compare a date range...
DECLARE
@CurDate VARCHAR(14)
SET @CurDate =
SELECT CONVERT(VARCHAR, GETDATE(),112) + CONVERT(VARCHAR,DATEPART(HOUR,
GETDATE())) + CONVERT(VARCHAR,DATEPART(MINUTE, GETDATE())) +
CONVERT(VARCHAR,DATEPART(SECOND, GETDAT... more >>
Full Text Setup
Posted by Rob T at 4/7/2006 3:23:42 PM
I'm trying to set up Full-text indexing. I installed the module, the
service shows up in control panel\services, but the option in EM is still
grayed out. Any suggestions?
FYI: SQL2000 on XP pro, rebooted machine...
thanks. -Rob T.
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
PLS HELP! Problem with column width
Posted by MuZZy at 4/7/2006 3:19:30 PM
Hi,
We have a "bad" table in our database - sum of all 30 field widths
exceeds 8000 bytes. It still works fine unless all fields are filled
completely, and that's what happened to one of our clients. Now he can't
do any updates/inserts to the table.
I need to find which row created the p... more >>
Updating new column with part of another
Posted by JR at 4/7/2006 3:18:48 PM
I have a column that for now is text data however are really decimal
numeric values. I want to take everything on the left of the decimal
and stick it in a new column, same row, called whole_number and stick
everything on the right side of the decimal point into the
decimal_number column, same ... more >>
Max Value in Column Other than Return Value Column
Posted by John Walker at 4/7/2006 1:46:01 PM
Hi,
This may be a very simple query but I couldn't figure out how to do it. I
have a table with two columns, COL1 and COL2. I need to write a query that
will return the value of COL1 from the row where COL2 has the greatest value.
For example,
COL1 COL2
---- ----
A 2
B 3
... more >>
SSIS -- Copy object from SQL 2000 to SQL 2005
Posted by MT at 4/7/2006 11:54:51 AM
I have converted a DTS package to a SSIS package. This package copies
a table from a (still) SQL 2000 DB--running in SQL 2000 to a SQL 2005
DB. I am using the Transfer DB Task object and am getting the
following error: "Version90 Database compatibility level is not
supported".
The source D... more >>
SQL eating all memory
Posted by Darren Woodbrey at 4/7/2006 11:44:41 AM
I have sql 2000 installed on a Dell Poweredge dual Zeon 3.2 Ghz with 2 GB of
RAM. It has a database that runs an asp website and it also hase a database
for our accounting package, Microsoft Great Plains.
About twice a week, the website and the application will slow down on the
workstation... more >>
use variable in where statement
Posted by Helen at 4/7/2006 11:38:02 AM
This piece of code doesn't work. Any idea?
declare @id varchar(20)
set @id = '(12,13)'
select * from appusers
where id in @id... more >>
Selecting min from duplicate records
Posted by mkarnofel NO[at]SPAM gmail.com at 4/7/2006 11:26:43 AM
Greetings,
I am trying to create a query that will select the minimum cost from a
set of "nearly" duplicate records. What I mean by "nearly" is that
they are duplicate items with different prices and plans. Here is an
example the records:
Mfr Item UM Plan Price
KC-AAG AAG... more >>
Selecting Fields not to include in SELECT statement
Posted by Kevin at 4/7/2006 11:25:02 AM
Hi.
Is there a way to select all fields in a table but exclude one or more?
For example if I want to get all fields in a table called Names except the
BirthDate field a query might be:
SELECT FirstName, LastName, Height, Weight, FavoriteColor
FROM Names
Is there any easier way without... more >>
Convert Date to String
Posted by Pancho at 4/7/2006 11:13:02 AM
Hello, I have a date field in a table. I don't need the time part. I want
the result to be in the format YYYYMMDD. Consulted BOL and it gave me:
SELECT CONVERT (char, fieldname, 8). Tried that and I get the time hours.
How can I get it to read from the left and only give me YYYYMMDD? Th... more >>
Unexpected NOT IN results
Posted by David D Webb at 4/7/2006 10:41:19 AM
Is there any difference between these 2 statements. The first one returns
no rows, yet the second returns 137 rows. 137 is the correct results. I
must be missing something. ssn is a varchar in both tables.
SELECT * FROM Eligibility WHERE ssn NOT IN (SELECT ssn FROM Clients)
SELECT * FR... more >>
importing data from Oracle - Is there a limitations on the datatypes that can be retrieved?
Posted by J. Adeli at 4/7/2006 10:31:13 AM
Trigger logic question - using If with AND and OR
Posted by Rich at 4/7/2006 10:30:30 AM
Hello,
I have a trigger - which works if I set the body up as follows:
....
If ((select count(*) from inserted) < 2)
Begin
If ((select uniqueSubscrID from inserted) Is Null) Or ((select
uniqueSubscrID from inserted) = '')
Begin
--enter body of trigger when All If conditions a... more >>
appending data to a text column
Posted by kw_uh97 at 4/7/2006 10:29:57 AM
Hello everyone, I'm a newbie so have some mercy please. Please feel free to
make some best practice suggestions. Here we go, I am importing data into a
table within my database. I'll use some DDL for clarity.
Create table ImportTable
(ImportId int Not Null,
ImportLog text (10000)
)
Cre... more >>
Performance question
Posted by Ashhad Syed at 4/7/2006 10:29:01 AM
I have written a stored procedure to obtain businesses in a given zipcode
radius(eg: Get all chinese restaurants in 10 miles from 94568 zipcode). All
the fields being used in the main stored procedure query are indexed. When I
run the stored procedure for the first time after a long time, it t... more >>
Invalid Column Names?
Posted by Darrell at 4/7/2006 10:25:00 AM
Here is my code:
DECLARE curCAED1 CURSOR FAST_FORWARD FOR
SELECT * FROM okc_contr_license
WHERE CONTR_TYPE = 'ME'
ORDER BY CONTRACTOR_NUMBER
OPEN curCAED1
FETCH NEXT FROM curCAED1 INTO
@pContrType, @pContractorNumber,
@pCityLicType, @pCityLicNumber, @pCityLicRenDate,
@... more >>
SQL/CLR books
Posted by Craig Berntson at 4/7/2006 10:10:18 AM
I have a new assignment to rewrite some Extended Stored Procedures using
..Net integrated into the CLR. Are there any good books that can help me with
CLR integration in SQL Server 2005?
--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.sl... more >>
sp_executesql and datetime
Posted by ina at 4/7/2006 9:45:16 AM
Hello all,
I have this code and I do not know why I have this error.
EXECUTE sp_executesql
N'SELECT * FROM TABLE
WHERE T_ID = @level and timestamp = @timestamp',
N'@timestamp datetime',
N'@level int',
@level = '1' and @timestamp between '2006-03-01' and '2006-03-31'... more >>
Trigger question
Posted by Jchick at 4/7/2006 9:32:01 AM
This outta be an easy one for someone. I have the following code in my
trigger. I am trying to connect to a DSN that is pointing to an Access
database (.mdb). However, I am not sure how to actually write the
Select From statement (see "A DSN I MADE" in the code below).
Any hints as to how I re... more >>
HELP WITH TRIGGER
Posted by APHILLEY NO[at]SPAM WATSONFURNITURE.COM at 4/7/2006 9:09:15 AM
Hi I am trying to write a trigger that will prevent anyonr from changin
a closed customer order. This is what I have so far..
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER can_not_change_a_released_order on CUSTOMER_ORDER for
UPDATE as
if update ()
begin
raiserror ... more >>
[OT] There should be a law...
Posted by Mike Labosh at 4/7/2006 9:04:27 AM
....against wives sneaking up behind their husbands asking about coffee in
the morning, after the husband had been playing Doom for several hours.
If that had been a REAL shotgun, she would have been splattered all over the
wall. I'm going to go change my underwear now.
--
Peace & h... more >>
Why am I missing rows in my result set?
Posted by arch0041 at 4/7/2006 8:22:03 AM
I have a table with 90,000 rows. Each row has 2 latitude and 2 longitude
values for two different locations (lat1,lat2,lon1,lon2). I have a
calculation that will give me the difference between the two locations. When
I run the following
Select Distance = 3963.0 * acos(sin(lat1/57.2958) *... more >>
Advanced T-SQL Question: Produce Backup Window Gantt Chart
Posted by Kael_Sidhe NO[at]SPAM yahoo.com at 4/7/2006 6:51:51 AM
I'm an Oracle DBA who inherited 100 or so SQL Databases. I know how I
would accomplish this task in Oracle but I have no clue how to do it in
T-SQL. In short, I want to produce a comma delimited gantt type
timeline chart of my Backup Windows for import into Excel.
I'm not sure if this is the... more >>
SQL Performance difference
Posted by resist at 4/7/2006 4:40:46 AM
Hi,
During som performance optimization I ran into the following strange
performance difference.
I performed a query basically counting 10 different tings from a set of
tables. Thus I had 10 different joins and where clauses giving me 10
different counts.
I have constructed this example wi... more >>
Prioritise the execution of a specific Stored Procedure
Posted by D Johnson at 4/7/2006 4:32:01 AM
Hi
I wondered if SQL Server 2005 would allow some sort of option to be set that
would allow a specific Stored Procedure to receive a higher execution
priority.
Thanks in advance.
David... more >>
Stored Procedure Name
Posted by S Chapman at 4/7/2006 4:21:56 AM
Is there any performance overhead if a stored procedure name starts
with 'sp_'? I have heard that if the name starts with 'sp_', Sql Server
checks for the SP first in the master database. Is this correct? Thanks
... more >>
Registering by massive way sql servers
Posted by Enric at 4/7/2006 4:02:02 AM
hi everyone,
Imagine you have 20 workstations and for each of them you've got to register
by MMC around 30 sql servers. It's stupid to imagine do a registered one by
one if you know that all of them have the same password and overall, you have
a list containing the IP's
file:
10.0.12.1 us... more >>
sql gathering data from Internet?
Posted by Enric at 4/7/2006 3:22:01 AM
Dear all,
I am just struggling myself and pulling out my hair trying to think how to
obtain online data from a site and load them into Sql Server.
I've thought to use a DTS, which at a specific hour might open a URL and
might read from there the data needed.
I know it's hard to draw/imagi... more >>
query?
Posted by js at 4/7/2006 12:17:04 AM
Hi,
i have several Paragraphs in one table, how to do this:
Can I regroup Paragraphs base on a number?
For example,
I have 3 Paragraphs:
1. Test1
2. Test2
3. Test3
if I pass 2, will regroup as:
Test1, Test2
Test1, Test3
Test2, Test3
Test3, Test1
Test3, Te... more >>
assign a table to a path and filename?
Posted by Markus Zingg at 4/7/2006 12:00:00 AM
Hi group
I'm a newbee, so please bear with me if this is a stupid question.
I would like to have a one to one relationship on the server with
regard to tables created in a database and the file(s) the data ist
stored. From what I understand, when I create a database on the
(sql2005) server,... more >>
query timeout expired
Posted by Tlink at 4/7/2006 12:00:00 AM
I am performing a update to 2m+ records, when it reaches 200 records it
times out ?
rsobj = db.execute("select * from Somefile where t2 is null;")
do while
db.commantimeout = 0
******** newexp & newfactor are calculated *****
SQLLine = "UPDATE Australia..InProgress SET t2 = '" &... more >>
how to get back image from table?
Posted by supriya at 4/7/2006 12:00:00 AM
Hi all,
i have one image column in my table.
i inserted one image in that.when i select
that value it is giving hex value.How can i get my image back.
Thnx.
... more >>
Storing text files in a column
Posted by Gabriel Lacatus at 4/7/2006 12:00:00 AM
Hello,
I'm trying to store an HTML page inside a table column (for debugging
purposes).
I tried the varchar type but 8000 chars are way to few for this. Then I
turned to the text datatype and I learnt that while in a stored procedure
that say inserts a line using a text type variable you sho... more >>
ROLLUP and summarazing values
Posted by simonZ at 4/7/2006 12:00:00 AM
I have query:
SELECT column4,column5,sum(column1)as sum1,sum(column2) as sum2,sum(column3)
as sum3,
result=case when sum(column1)<(sum(column2)+sum(column3)) then 0 else
sum(column1)-sum(column2)-sum(column3) end
FROM testTable GROUP BY column4,column5 WITH ROLLUP HAVING column4 is not
nu... more >>
What are new featuture of vs 2005
Posted by rakesh at 4/7/2006 12:00:00 AM
I want to know about the new feature in c# , .net and Sql 2005 as compare to
previous version. Like difference between SQL Server 2000 and 2005.... more >>
System catalog - defaults
Posted by lh at 4/7/2006 12:00:00 AM
How can I check for the default value of a column?
I can get to sysobjects where type='D' but I want to find what the value of
the default is.
TIA - LH
... more >>
|