all groups > sql server programming > november 2006 > threads for wednesday november 15
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
Move one table values into another table
Posted by Sirisha at 11/15/2006 11:52:31 PM
I want a query for selected rows in one table move to another
table(insert into another table)
... more >>
SQL UDF Returns Table
Posted by masmith at 11/15/2006 10:14:17 PM
Is there any way to declare a variable in a function that returns a table
example
CREATE FUNCTION [dbo].[SQLTest]
()
RETURNS table
AS
Declare @TEST nvarchar(200) --This does not work
Select * from table
--
Message posted via http://www.sqlmonster.com
... more >>
When do functions get applied?
Posted by Matt at 11/15/2006 9:44:01 PM
Given a statement such as this:
SELECT myUDF(ColumnA), ColumnB
FROM tableQ
WHERE ColumnB = 'SomeValue'
Does the myUDF function still get executed against every record in the
table, even though the WHERE clause contains enough information to allow the
myUDF function to execute against onl... more >>
Max Functions
Posted by Sirisha at 11/15/2006 7:47:33 PM
How to get Second Maximum Value in a table using sqlquery
... more >>
Delete records in bulk from SQL Server 2000
Posted by Venkat at 11/15/2006 7:01:26 PM
Hi,
Is there any best way to delete bulk records based on a where
condition from sql server 2000? I have a table which contains tons of data.
It contains 5 columns and it has a clustered key by using a composite key (3
columns and all three columns are of integer data type).... more >>
Linked Server - communication error message ...
Posted by MobileMan at 11/15/2006 3:55:01 PM
I appologize if this is a rookie question, but we're having some problems
setting up a Linked server between SQL Server 2000 and 2005. The link works
perfectly fine from 2000 to the 2005, but we get the following error when we
go the other direction (2005 to 2000):
OLE DB provider "SQLNCLI... more >>
Help! Trying o debug a divide by zero error in UDF
Posted by DarrylR at 11/15/2006 3:37:25 PM
Hello. I'm trying to write a user-defined function that leverages the
Transact-SQL POWER and DATEDIFF functions to calculate a decimal.
Unfortunately, I'm writing it in in SQL Server 2000 (no Try/Catch), and I'm
having trouble with error handling. I have a Divide by zero error that
occurs despit... more >>
Maintenance Plan does not remove old backups
Posted by Jim Abel at 11/15/2006 3:17:02 PM
I have a SQL Server2000 on Window Server 2000. The SQL server has a
maintnance plan for the user databases that is supposed to remove the old
backups. This had been working fine and then 8 days ago it stopped the
deletions. I am only doing full backups each day and no transaction backups.
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Are updates via stored proc atomic?
Posted by Chris Dunaway at 11/15/2006 2:41:03 PM
I have the following simple stored procedure:
CREATE PROCEDURE [dbo].[UpdateBalance]
@Id int,
@Amount money
AS
BEGIN
SET NOCOUNT ON
Update ClientData
Set Balance = Balance + @Amount
Where Id = @Id
END
I created a test C# application which called this procedure on two
thread... more >>
Q:Recomendation SSIS package location
Posted by iano at 11/15/2006 2:18:55 PM
I am just about to put my first ssis package into production. Not only
is it my first, its the first one where I am working. SSIS gives us
choices about locations in which to store the packages. Would someone
care to discuss the pros and cons of each?
Any "war stories" of your experience are a... more >>
INSERT where there are characters and DO NOT INSERT where there ar
Posted by wnfisba at 11/15/2006 2:13:02 PM
I have some data that overflows, past 75 characters and other rows that
don't. Is there any way to qualify my INSERT statement below??? What I have
"<> ''...is not working...
Thanks in advance for your help...
wnfisba
/* INSERT rows to custom_data doc_01 and doc_02 Non-Eligible Borrowe ... more >>
select rows where top 1 column matches other column in self join?
Posted by Rich at 11/15/2006 2:03:01 PM
select Distinct coRecID from tbl1 where col1 = 'x' and col2 = '12/31/06'
returns 1000 rows for example
select Distinct RecID, coRecID from tbl1 where col1 = 'x' and col2 =
'12/31/06'
returns 1660 rows -- I added one more column to the same query
I need a query that returns the 1000 dis... more >>
sp_tables_ex and catalog names with underscore character
Posted by John O at 11/15/2006 1:32:01 PM
Hi All,
I have customers who are using linked servers to connect to remote SQL
servers. In my code, I'm using sp_tables_ex to return a list of remote
tables. However, if the remote catalog has an underscore in the name, the sp
returns no results.
for example:
exec sp_tables_ex 'remotese... more >>
turn off 1 row(s) affected
Posted by SQL Ken at 11/15/2006 12:01:41 PM
Hi,
after you ran the query, in the messages tab,
it says: No of row(s) affected.
How can you turn this off
thanks
... more >>
help with ORDER BY please
Posted by trint at 11/15/2006 11:18:18 AM
I have this query:
SELECT *
FROM custom_carts
where id = #attributes.cid#
and I need to add an 'order by'
for the 'position' column to start with the last entry first please.
here is an example of the table:
id | file_name | description | thumb_name | name | position
1 a.jpg ... more >>
Date Comparison
Posted by david.wilson2 NO[at]SPAM wachovia.com at 11/15/2006 10:47:10 AM
Hi,
I have a table that holds a list of user data including a
Target_End_Date. Several rows can share a single ID, while there is a
current flag that sets the most recent record as the active record.
All other records for that ID are history. I want to be able to
compare the Target_End_Date... more >>
Upgrading Access project to Intranet based one
Posted by Jay at 11/15/2006 10:16:02 AM
Thanks in Advance
MY aceess (MDB) project (Emp.mdb) is a stand-alone application.
It gets data from SQL Server 2000.
Here is what I need to do.
I want to upgrade my Access project so that company users log in and run my
access project in company Intranet. Should I redo everything to fit into... more >>
dimension fact table question
Posted by SQL Ken at 11/15/2006 10:07:47 AM
I want to measure how often a video is being rent. Since the video is
being rent regularly and multiple time in a day.
How do I do a fact and dimension table this.
I got this fact table, but don't know where the "number of time being
rented' fits into this.
factProduct
VideoID, Name, Ca... more >>
If/Then in SProc
Posted by Elmo Watson at 11/15/2006 9:57:03 AM
I need to make a change in a Stored Procedure and I'm not sure how to do
it....
I have two parameters, one of which is:
@OtherParameter='' (defaulting to empty string, making it optional)
if it indeed, is empty, I don't want to use it at all in the select
Statement - I need something l... more >>
What is the 'N' preface character for strings in T-SQL
Posted by Quimbly at 11/15/2006 9:50:01 AM
E.g.
SET NOCOUNT ON;
USE Northwind;
DECLARE @schemaname AS NVARCHAR(128), @tablename AS NVARCHAR(128);
SET @schemaname = N'dbo';
SET @tablename = N'Orders';
DECLARE @objectname AS NVARCHAR(517);
SET @objectname = QUOTENAME(@schemaname) + N'.' + QUOTENAME(@tablename);
EXEC(N'SELECT COUNT(... more >>
Last Updated Data
Posted by Jay at 11/15/2006 9:49:02 AM
Thanks in advance
Company has a OCR scanner and it scanns a employee_info sheet.
These scanned data are appended into Empl_info table in SQL Server.
Problem is:
Sometime, employee_info sheet is updated and scanned several times on same
date.
Help:
In Empl_info table I want to collect o... more >>
error on ALTER table
Posted by samuelberthelot NO[at]SPAM googlemail.com at 11/15/2006 9:48:34 AM
Hi,
I'm doing the following :
ALTER TABLE [Publication]
ADD CreatedBy INT (4)
ADD DateCreated SMALLDATETIME DEFAULT GetDate()
GO
But I get the following error :
Incorrect syntax near the keyword 'ADD'
Can't figure out what's wrong ?
Can you help ?
... more >>
T-SQL DateTime question
Posted by ChrisMiddle10 NO[at]SPAM gmail.com at 11/15/2006 9:43:09 AM
Let's say I want to create a DATETIME object that is 6 months prior to
the value returned by GETDATE(). How is that done in T-SQL? Can a date
be built from the results of a DATEDIFF or some other function in
T-SQL?
Thanks,
CHRIS
... more >>
Query question
Posted by SteveJ58 at 11/15/2006 8:51:03 AM
I have two tables A & B and need to remove any records that appear in B from
A i.e. A-B.
The following query achieves this:
SELECT A.* FROM Table1 A WHERE (NOT EXISTS (SELECT 'X' FROM (SELECT * FROM
Table2) B WHERE A.ID = B.ID))
The problem arises when I filter this data on a date fiel... more >>
Best Free Programming Language for GUI programming with SQL Server
Posted by BillyRogers at 11/15/2006 8:14:02 AM
I don't have Visual Studio and I'd like to expand my programming beyond just
using Access and ADO with SQL Server2000. I know there are some free
programming languages out there, but many of them seemed geared toward
programming unix and other systems.
I want something that I can build GU... more >>
Restoring database to different server using SMO
Posted by Gary at 11/15/2006 7:39:02 AM
I have some .NET SMO code in a Windows service (on server A) that connects to
a SQL server on server B and restores a database from a file stored on server
C, all using a SQL server login and password. This was working perfectly
fine until servers A and B crashed and had to be rebuilt.
I... more >>
Time Value from DateTime
Posted by Mark J at 11/15/2006 7:26:02 AM
I would appreciate any help with this;
SELECT DateTime AS [Date], TagName AS TagName, MAX([Value]) AS [Value]
FROM AnalogHistory
WHERE (wwResolution = 20000) AND (wwRetrievalMode = N'Delta')
GROUP BY DateTime, TagName
HAVING (DateTime = CONVERT(DATETIME, '2006-11-12 00:00... more >>
Missing date in sequence
Posted by NH at 11/15/2006 6:12:01 AM
Ok, I am not great with working with dates in sql, and even worse with
sequences, I just cant get my head around it.
I have a table that holds the currency rates for each currency for date
periods.
The table is structured like this...
create table #dates (currency varchar(4),startdate d... more >>
ASCII Conversion to UTF
Posted by Marcus Ross at 11/15/2006 5:47:02 AM
Hi,
I have a Table with Item Descriptions. The Description Field is varchar. The
Data itself is written in ASCII (MS Navision ERP). If I make a SELECT, I got
the Description with Special Chars like "Lautsprecher, weiÂ, fÜr PC" which
should be "Lautsprecher, weiß, für PC". The german cha... more >>
Space usage for non Clustered Index With Include clause
Posted by Prashant at 11/15/2006 5:36:02 AM
I have a table with two indexes on it first one is on primary key having a
clustered index. Second one is a Non clustered index involving 8 columns (2
integer, 2 Varchar (255), 2 Numeric (18,2) and 2 bit columns). Total no of
records in my table is 500,000. The clustered index size = 157808 K... more >>
Calculate an exponential moving average
Posted by Bob at 11/15/2006 2:04:48 AM
Hi there,
I'm wondering if this is possible in SQL Server 2005. I need to calculate the exponential moving average (EMA)
for a financial application. The moving average period is 34, thus a 34EMA. The formula for calculating the
EMA for a price is:
EMA(current) = ( (Price(current) - EMA(pr... more >>
backup effect on system performance
Posted by TradCom_SLU at 11/15/2006 1:50:32 AM
I presume a backup has some influence on overall system performance.
But is this effect noticeable? Or does SQL Server run a backup as a
low-priority background process?
Single CPU or double CPU, does it matter?
I ask this because our provider performs a full backup to a remote
location on th... more >>
syntax error in common table expression
Posted by moondaddy at 11/15/2006 1:35:16 AM
using sql 05 I'm trying to create a function which uses a common table
expression. Here the error I get when I run the script to create the
function:
Msg 319, Level 15, State 1, Procedure ufn_GetVIPScore, Line 16
Incorrect syntax near the keyword 'with'. If this statement is a common
ta... more >>
converting PK to clustered index
Posted by Roy Goldhammer at 11/15/2006 12:00:00 AM
Hello there
is there a simple way to convert all tabls with primary key nonclustered to
clustered?
... more >>
sysindexs without sysindexkeys
Posted by Roy Goldhammer at 11/15/2006 12:00:00 AM
Hello there
I've got indexes on sysindexes table without maching sysindexkeys.
how it is possible?
... more >>
numeric fields
Posted by Roy Goldhammer at 11/15/2006 12:00:00 AM
Hello there
Is there a simple way to know if on some field of tables all the data is
numeric or not?
... more >>
newbie parameter question
Posted by Alan at 11/15/2006 12:00:00 AM
I have this procedure:
CREATE PROCEDURE [dbo].[GetBanner]
@BannerPage varchar(50)
AS
BEGIN
SET NOCOUNT ON;
SELECT TOP 1 BannerID,
BannerFileName,
AltText,
URL,
Views
FROM Banners
WHERE BannerPage = @BannerPage AND StartDate <= GetDate() AND EndDate
>=GetDate()
ORDER BY Vie... more >>
Nested Query Doesn't work
Posted by Shimon Sim at 11/15/2006 12:00:00 AM
Hi
I have following nested query
SELECT *
FROM
(
SELECT COUNT(ae.AccountEntryId) AS ItemsNumber, ae.TransactionId
FROM gAccountEntry AS ae INNER JOIN
gBills ON ae.TransactionId = gBills.TransactionId
WHERE (ae.AccountId <> 2001)
GROUP BY ae.TransactionId) bi
It used to ... more >>
'SQLOLEDB' failed with no error message available, result code: E_OUTOFMEMORY(0x8007000E).
Posted by Ch.Mueller at 11/15/2006 12:00:00 AM
Hi,
I have 3 programs with about 20 Threads. The programs read and write to
a SQL-Server-DB. After 20 min. there is an error in one Programm during
a select-statement (the same works 20 min. without error).
'SQLOLEDB' failed with no error message available, result code:
E_OUTOFMEMORY(0x800... more >>
Comparing SP's and Triggers
Posted by Robert Bravery at 11/15/2006 12:00:00 AM
Hi all,
whats the best and esiest way of comparing SP's and triggers between two
different databases
THanks
Robert
... more >>
Q: Tricky selection question.
Posted by Martin Arvidsson (Visual Systems AB) at 11/15/2006 12:00:00 AM
Hi!
I have two tables. Lets call them AccountInfo and AccountTransactions
I have made a query that uses join between AccountInfo and
AccountTransactions.
Grouping them and made selections. Now this works like a charm.
How ever, the AccountInfo contains 12 fields that i would like to make... more >>
number of records in table
Posted by Roy Goldhammer at 11/15/2006 12:00:00 AM
hello there
Is there a way to know with sql funcion how many records are in each tables?
... more >>
Pretty SQL Formatter
Posted by Ralf Mayer at 11/15/2006 12:00:00 AM
I wonder if such a thing exists...
I do often have to copy & paste SQL from Applications (VBA or VB.NET) to the
SQL Editor, either in Query Analyser or the new 2005 counterpart.
The source often looks like this (including quotes now!):
"SELECT xy FROM abc WHERE z = 2"
or better and worse... more >>
SQL Server Personal Edition
Posted by Bassam at 11/15/2006 12:00:00 AM
Hello,
Is there an equivalent to SQL Server 2000 Personal Edition in SQL Server
2005 ? if not is that means the only versions to be installed in the client
or developer machine are Express or Developer ?
Thank you
Bassam
... more >>
Set DateFirst
Posted by Goofy at 11/15/2006 12:00:00 AM
Someone kindly gave me this function to try, but I need to use the Set
DateFirst command, but when I try and insert it into this function it fails,
Ive tried it before and inside the function with different error messages.
Please excuse my novice question.
Thanks Goofy
CREATE FUNCTION ge... more >>
|