Extra Word At The End Of Select
Jun 1, 2004
I have a strange SQL statement
Select * from TableName WH
Basicly I have a code that creates a Dynamic SQL statement
in this case I thought that I will get an error on the above statement but infact I did not
I tested it on the Enterprise Manager
and it works fine
I changed the WH to WHER it works as long as its not a reserved word
so if I put my name or what ever after that sql it still works
unless I use two words with a space between them it will give an error
on the second one not the first
Can anyone tell me why is that
I do not know if its a feature or what
Thank you in advance.
View 4 Replies
ADVERTISEMENT
Nov 29, 2007
Far below (in section "original 3 steps"), you see the following:1. a temp table is created2. some data is inserted into this table3. some of the inserted data is removed based on a join with the sametable that the original select was made fromIn my opinion, there is no way that the join could produce more rowsthan were originally retrieved from viewD. Hence, we could get rid ofthe DELETE step by simply changing the query to be:INSERT INTO #details ( rec_id, orig_corr, bene_corr )SELECT rec_id, 0, 0FROM viewDWHERE SOURCE_SYS NOT IN ( 'G', 'K' )AND MONTH( VALUE_DATE_A8 ) = MONTH( @date )AND YEAR( VALUE_DATE_A8 ) = YEAR( @date )AND INMESS NOT LIKE '2__' ---- the added line===== original 3 steps (mentioned above) =====CREATE TABLE #details (rec_id UNIQUEIDENTIFIER PRIMARY KEY NOT NULL,orig VARCHAR(35) NULL,bene VARCHAR(35) NULL,orig_corr TINYINT NULL,bene_corr TINYINT NULL)INSERT INTO #details ( rec_id, orig_corr, bene_corr )SELECT rec_id, 0, 0FROM viewDWHERE SOURCE_SYS NOT IN ( 'G', 'K' )AND MONTH( VALUE_DATE_A8 ) = MONTH( @date )AND YEAR( VALUE_DATE_A8 ) = YEAR( @date )DELETE dFROM #details dJOIN viewD v ON ( d.rec_id = v.rec_id )WHERE INMESS LIKE '2__'
View 1 Replies
View Related
Mar 23, 2008
Hi,
I've got a table with trialsubscriptions. When someone orders a trialsubscription he has to fill in a form. With the values in the form I like to fill a database with some extra fields from the trialsubscription table. I get those extra fields with a datareader. But when I insert I can't use the same datareader (its an insert), I can't make two datareaders because I have to close the first one etc.
Does someone had the same problem and has some example code (or make some :-)) Some keywords are also possible!
Thanks!
Roel
View 3 Replies
View Related
May 14, 2008
Is it possible to select words that have a certain char size in a given field?
View 1 Replies
View Related
May 29, 2014
In company there are two version of app. New one save order status as "Ordered" the old save as "ORDERED". In order to find out who use old version, how to code in where clause like below?
select userid from order where status = 'ORDERED' (only capital)
(Above code will list all)
View 1 Replies
View Related
Oct 10, 2007
I have an application providing me with multiple headers which I havemergerd into one big header (below), this header my not always be thesame but I need to be able to extract a periodstart and periodend fromit. The periodstart will always be the third substring from the end(or 3rd from right) and the periodend will always be the firstsubstring from the end (or 1st from the right).How can I extract the periodstart and periodend?E.g:- Header'Jensen Alpha TR UKN GBP BM: Caut Mgd BM (50% FTAllSh 50% ML £ BroadMkt) RF DEF:RFI 3Y 31/08/2004 To 31/08/2007'I currently have the sql: convert(Datetime,(dbo.FDHGetWord(@FullHeader, 20)) ,103) but this only works in thisinstance, I need to use someting like the RIGHT function or REVERSEfunction but I can't get the sql right.Can someone please help!????
View 1 Replies
View Related
Feb 24, 2008
i have report with parameter and he can have a null in parameter ther is null word can i change it to another word like all or any thing else
View 4 Replies
View Related
Mar 30, 2005
hi!
I'm just wondering does anyone know how to create an sql command that can search word by word?
what i mean is like I have a product with name 'harry potter broom'.
I want an sql command where if i type only 'harry broom' this 'harry potter broom' product will show up.
Does anyone have any idea?
Here's my sql comand: (I'm using asp.net vb script do develop this system)
-------------------------------------------------------------------------
query = "select distinct * from product where " & _
"(pname like '%" & keyword & "%' or " & _
"pdesc like '%" & keyword & "%' ) and " & _
"(price >= " & price1 & " and price <= " & price2 & _
") and status <> 'out of stock' order by price asc"
-------------------------------------------------------------------------
Thank you.
View 4 Replies
View Related
Sep 24, 2007
Is the word "Name" a reserved word in SQL? look at line 10 of my stored procedure. When I use the word "Name"it is highlited in blue by SQL Server?
Note I only list part of the stored proc
1 CREATE PROCEDURE [dbo].[GetXMLPeopleNames] 23 (4 @Status nvarchar(3)5)6 AS7 SELECT8 PersonId,9 PersonDescription,10 Name,11 UpdateDate,12 UpdateAppUser13 FROM14 Customer WHERE Customer.PersonDescription=@Status15 ORDER BY
View 2 Replies
View Related
Jan 19, 2007
Hi all,
I work for a financial company where we send out lots of correspondence to clients on a daily and monthly basis. This would typically be something like a financial report, account statements, etc. We've decided to use PDF as the format which these documents must be in when our clients receive them.
Our marketing and sales departments designs the templates of these documents using Microsoft Word. They can save these MS Word documents in the Word XML format (either 2003 or 2007). We want it in XML format, because it is text based, and we can therefore string replace the content to update the template with a client€™s information. In the same token RTF would also do, but the file size when converted to RTF is a problem.
What I am looking for is a way to convert this XML into PDF using something like XSL-FO - i.e. we do not want to use the Word Interopt on our Production Server, firstly it is a little slow and secondly the production server is unmanned and we cannot allow a WinWord.EXE process to not close successfully for some or other reason.
I've tried a number of companies' evaluation software to try and achieve this (converting the WordML to PDF via XSL-FO), but so far no luck.
Does anybody know of a stylesheet out there with which I will be able to achieve this? Or an alternative method of converting MS Word files into PDF without using Word to do it?
Thank you in advance.
Regards
View 4 Replies
View Related
Jan 18, 2007
hi all,
i wonder if i could break one row to multiple row base on this case :-
status=A OriginQty=10 HoldQty=3
i want to print the status=H for the remaining originqty-holdqty
isit possible to digest this data in my SP to:-
status=A BalQty=7
status=H BalQty=3
~~~Focus on problem, not solution~~~
View 2 Replies
View Related
Jan 17, 2008
HI
When I'v click in Visual Web Developer 2008 to build web site it has made a new MDB file name ASPNETDB. MDF
So now I have 2 mdb file (MyFileName.mdf and ASPNETDB. MDF)
What is that extra (ASPNETDB. MDF) file and do I need it and why?
Thanks assaf
View 1 Replies
View Related
Sep 20, 2005
Hi,
I used excel to import data to my database, I found out a problem, my program is linked with the database, when the program show data from the database, it has an extra '@' symbol, In order to remove it, I need to go to the database to press space bar and backspace at the field. How could I use SQL instead of using space bar and backspace?
Thanks
Frenk
View 7 Replies
View Related
Apr 14, 2006
Here is the basic sql I am trying to implement:
select classid, count(*) as [COUNT], dtmready from unit
where rmpropid = '123' and classid = 'A1'
group by rmpropid, classid, dtmready
order by dtmready;
Here is my result set:
A1 3 2006-07-01 00:00:00.000
A1 10 2006-08-15 00:00:00.000
A1 11 2006-09-15 00:00:00.000
A1 10 2006-10-15 00:00:00.000
A1 10 2006-11-01 00:00:00.000
A1 10 2006-11-30 00:00:00.000
If you notice, the earliest dtmready is 7/1/2006. What I need is to return an additional row when the earliest dtmready is after today. The desired row would be:
A1 0 (today's date)
Background: I am running SQL Server 2000 SP4 and the results of the query are returned to a java program at a level where I do not have the ability to create a new row. So, it would be ideal if I could create the sql that returns a row with a dtmready of today with a count of 0.
View 4 Replies
View Related
Feb 5, 2002
Our company wants to run web based application
in folowing way.
Browser --> WebServer -->Sql Server
Sql server is part part of corporation domain and has about 25 more databases
Should we dedicate extra SQL server to run Web apps , or it would be safe to run web apps on corporation Sql Server?
or
If any one can point on links on this subject?.
Thank you
View 1 Replies
View Related
Jul 10, 2006
I have some fields in my database that are char(50)
I use an insert to put some text into the fields (using perl)
when I look at the fields I find that spaces are used to "pad out" the text to the field size.
This didn't happen with MySQL and PHP, is there any way to disable this?
View 5 Replies
View Related
Feb 17, 2005
I have the following sql statement:
SELECT FTE_CLASS_GROUP_NBR_DSCR
FROM dbo.DLIST_FTE_CLASS_GROUP
WHERE FTE_GRP_ID IS NOT NULL
This is an example of the result returned:
9999/00 Some lenghty text is displayed after the numbers
I want to trim everything after 9999/00
Is there a way to use rtrim to remove the characters after the numbers or another method?
Thanks,
-D-
View 1 Replies
View Related
Jul 22, 2005
Hi
I've also got an inconsistency problem!
My CHECKDB says:
Server: Msg 8952, Level 16, State 1, Line 1
Table error: Database 'Multiflex_YBS', index 'mf_InvObject.I_mf_InvObject_Archived' (ID 308196148) (index ID 2). Extra or invalid key for the keys:
Server: Msg 8956, Level 16, State 1, Line 1
Index row (1:1189627:69) with values (Archived = Jul 6 2005 10:04PM and InvObjectId = 4374699) points to the data row identified by ().
"Extra or invalid key" ? How can that happen?
Kind regards,
Thomas Holmgren
Denmark
View 10 Replies
View Related
Jan 23, 2006
Hello
Before I start just wanna say thanks for all the top advice so far - much appreciated. My current quandry is this:-
I have a table called STOCK with columns ITEM_ID, ITEM & PRICE. Most of the stock is my own produce but i do buy-in some items. What i want to do is add some extra columns to STOCK for the supplier details on those items i buy in. The problem is that a lot of the fields in the supplier details columns will be empty. Would this be a problem or would it be better to have a seperate table for supplier details?
Jill
View 9 Replies
View Related
Mar 20, 2007
I have a table sample:
DECLARE@Sample TABLE (Merchant VARCHAR(1), OldOrder INT, OrderType VARCHAR(20),
NewOrder INT, cdate datetime)
INSERT@Sample
SELECT'a', 1, 'new', 1,'1/1/2003' UNION ALL
SELECT'a', 2, 'renewal',2,'8/2/2003' UNION ALL
SELECT'a', 3, 'renewal', 3, '2/1/2004'UNION ALL
SELECT'a', 4, 'renewal', 4,'11/1/2004' UNion ALL
SELECT'a', 5, 'renewal' ,5, '3/8/2006'UNION ALL
SELECT'a', 6, 'new', 1, '3/1/2004' UNION ALL
SELECT'a', 7, 'new', 1,'12/3/2005' UNION ALL
SELECT'a', 8, 'renewal',2, '8/2/2005'UNION ALL
SELECT'a', 9, 'renewal', 3,'9/2/2006'UNION ALL
SELECT'a', 10, 'renewal',4, '10/2/2006'UNION ALL
SELECT'a', 11, 'renewal', 5, '11/2/2006' UNION ALL
SELECT'b', 1, 'new', 1,'8/2/2003'UNION ALL
SELECT'b', 2, 'new', 1,'9/2/2003'UNION ALL
SELECT'b', 3, 'new', 1,'8/2/2005'UNION ALL
SELECT'c', 1, 'new', 1,'8/2/2004'UNION ALL
SELECT'c', 2, 'renewal',2,'8/2/2005' UNION ALL
SELECT'c', 3, 'renewal',3,'9/2/2005' UNION ALL
SELECT'd', 2, 'new',1 ,'8/2/2005'UNION ALL
SELECT'd', 3, 'renewal',2, '4/2/2006'UNION ALL
SELECT'd', 4, 'renewal',3, '6/2/2006'UNION ALL
SELECT'd', 4, 'renewal',4,'9/2/2006'
I want to remve all records serials startign with type 'new' (neworder 1) which is later than ,1/1/2005' and subsquncial renewals
The desire result should be:
MerchantOldOrderOrderTypeNewOrdercdate
a1new12003-01-01 00:00:00.000
a2renewal22003-08-02 00:00:00.000
a3renewal32004-02-01 00:00:00.000
a4renewal42004-11-01 00:00:00.000
a5renewal52006-03-08 00:00:00.000
a6new12004-03-01 00:00:00.000
b1new12003-08-02 00:00:00.000
b2new12003-09-02 00:00:00.000
c1new12004-08-02 00:00:00.000
c2renewal22005-08-02 00:00:00.000
c3renewal32005-09-02 00:00:00.000
Thanks.
Jeff
View 1 Replies
View Related
Nov 20, 2007
Hi!
I need to sync an application on windows mobile 5 that uses sql server mobile with sql server 2005. I've tried Merge and it populated the tables on the server with new fields and triggers. Does RDA do the same thing?
Jesus saves. But Gretzky slaps in the rebound.
View 4 Replies
View Related
Jul 7, 2006
I have asked for the following questions and I need your advises.Utilizing the Northwind database suppied with SQL Server, create SQL tosolve each of the exercises listed.1.I want to contact all customers who have received over $1,000 indiscounts on orders this year. Give me the name and phone number of theperson to contact at the customers site. Also, list the orders wherethe total discount was greater than $100. Remember, discount is apercentage of the price.2.Give me a list of suppliers and products where we do not have thestock on hand to fill the orders to be shipped. List out the customerand order information for each of the products involved.3.Give me a list of all orders that were shipped after the requireddate for the week of Jan 7, 2001. I want to know the name of theemployees that were responsible for the orders.4.We are having a golf tournament and I need some prizes. Give me alist of the top 5 shippers by dollar amount in the last year.5.Some customers are taking us for a ride on shipping. Give me a listof customers and the orders involved where more than ½ of their ordersare being shipped to a region other than their home region.Please advise ...thanks a lot
View 2 Replies
View Related
Feb 27, 2007
I have worked with straight-forward simplistic SSIS up to now, so I apologize if this is a simple question. I have a SQL table destination that accepts daily data from an AS400 table. We now have a need to datestamp the incoming data so I added a new column to the destination table where I want today's date. Is there a data flow transformation that I need to use to default the destination column to today's date? Time is not a consideration and not needed, just the date.
Thanks for the information.
View 4 Replies
View Related
Dec 27, 2007
Hi,
I am declaring a table with 2 column Id, and Name.
Id is a integer column but Name is a Varchar.
I am declaring Name as VARCHAR(100) you can say that varchar(100) is more than enougf for a name column. But lets suppose ifn futuer user will enter data only till 100 characters but lets suppose i put or declare it as NAME VARCHAR(4000), That means a column requires only 100 memory space but i am giving 4000 to that column
So in case of SQL any drwbacks are there for this approach. Meaning my 3900 space will not be used so will it a wrong thing or we can declare it as ,,, it will put no effect???
or what are the drawback??
View 3 Replies
View Related
Sep 20, 2006
Hello,
I'm trying to make a report with the following layout:
Car Sales 2004 2005 Var %
Total 10 20 50%
Green 7 14 50%
Red 3 6 50%
I'm using a matrix and the data is coming from a cube. One dimension called 'Years' is used to fill the matrix columns and the data corresponding to the car sales is filled by a measure called 'Sales'.
I've built part of the example but I can't add the final column ( the VAR% column).
If I try to add a static column in the end it apears only one year.
The behavior that I would like to have is simillar to the situation when we add the Subtotal column. Although, instead the sum() made by subtotal I would like to calculate the variation percentage between years.
Is there any way to add a final column into a matrix avoiding the problem that I'm having or maybe change the behavior of Subtotal column?
Thanks and best regards.
vjn
View 5 Replies
View Related
May 8, 2008
Hi there
I got the following returned simple dataset as follow:
ReportViewType; Category; Name; Units; Price;
LIST_VIEW; FRUITS; Apple; 1; $10
LIST_VIEW; FRUITS; Banana; 2; $11
LIST_VIEW; CARS; Corolla; 8; $100
LIST_VIEW; CARS; BMW; 10; $200
I've managed to grouped by Category field nicely and added extra calculated column for handling to total plus as well as Total for each group plus added a new row for TOTAL in the TABLE and returned as follow:
FRUITS
Apple; 1; $10; $10
Banana; 2; $11; $22
TOTAL FRUITS; $32
CARS
Corolla; 8; $100; $800
BMW; 10; $200; $2000
TOTAL CARS: $3000
TOTAL: $3032
Now I want to put another extra row underneath TOTAL for handling the calculated but the business rule is only for displaying from the first group for instance:
TOTAL: $3032
Calculated Average per fruits: $1010.67 ($3032 / 3 UNITS).
3 UNITS is coming from Units for Apple and Banana.
I don't know if I can do this cause i did try to use
=SUM(IIF(Fields!Category.value = "FRUITS", Fields!Units.Value, 0))
But it's successfully compiled but the report result error (#Error) on that field only. Any ideas? Also ... someone mentioned that I should look at the SCOPING but I don't work it how's work anyway.
I thought a simple like this can be handled quite easily instead of creating a new report view type in the the same dataset to handle this particular extra line.
Waiting your comment/feedback.
View 2 Replies
View Related
Jul 11, 2006
Hello,
When I export to PDF or Tiff, I am getting an extra blank page at the bottom of the document. Any ideas what might be causing this blank page during my export?
BTW...SSRS 2005 SP1
TIA!!!!
View 5 Replies
View Related
Apr 3, 2007
I need to be able to add an extra column to my matrix - I've searched high and low on the net and I cant seem to find the answer anywhere.
I have grouped data which displays as it should and I can get the SubTotal part for my Dailys to run - I need to add a total for MTD and YTD (which is a part of the SQL Data) after the subtotal - is there a straight forward way of doing this?
This is an example of how I want my report to look (I can already achieve the bits highlighted bold)
Daily Data
Commission (GroupData cell 1)
Interest (GroupData CELL 2)
GroupData etc €¦
SUBTOTAL (DTD)
MTD TOTAL
YTD TOTAL
Book
Currency
=sum(Fields!DTD.VALUE)
........
=sum(Fields!MTD.VALUE)
=sum(Fields!YTD.VALUE)
and this is an example of the data being returned by my Sproc
Book
CCY
GroupedData
DTD
MTD
YTD
ABC
GBP
Commission
£0.01
£0.09
-£0.10
ABC
GBP
Interest
£0.02
£0.29
£0.11
ABC
GBP
Brokerage
£0.12
£0.06
£0.20
When I use the "Add Column" functionality - I get a repeat of the MTD and YTD under each of the groupData cells - where as i only need it as a summary after the subtotal.
Daily Data
Grouped Data CELL 1
Grouped Data CELL 2
Book Name
Currency
DTD TOTAL
MTD TOTAL
YTD TOTAL
DTD TOTAL
MTD TOTAL
YTD TOTAL
=sum(Fields!DTD.VALUE)
Does anyone out there know how to do it?
View 7 Replies
View Related
May 27, 2007
I’m using a SQLDataSource to populate a dropdown. The SQL table I use to populate the drop down has two columns. I only want one of them to be displayed in the drop down but I need to make decisions later in the code based on both columns. How do I access that second column in the datasource?
View 4 Replies
View Related
Oct 10, 2005
I'm encountering a strange problem in all the applications I'm working on and am totally dumbfounded as to why it's occuring:From a standard web form I'm inserting a record using a stored procedure. (I'm writing this to a SQL 2000 db - where the column types and variables are all consistant) No matter what I do, the columns are padded with extra characters maxing out the field length (if it's nchar or nvarchar or char) after insert or update. I've tried Trim - ing the field.text values that I'm feeding to the @variables used in my stored procedure. I've even RTRIM() - ed the @variables within the stored procedure. No matter what I do I get extra spaces padding the end of the intended column input. Ideas anyone???Thanks in advance. - Abe
View 4 Replies
View Related
Mar 9, 2006
When I enter a data in a table, SQL Server automatically completes the data with blanks up to length of column.
this happens in a web form also in Management Studiıo,
Whan am I doing wrong ?
does Collation have anything with it ?
SQL Server 2005 / Developer Edition
View 2 Replies
View Related
Mar 28, 2002
I noticed our log files are getting way too big. I found that a previous
SQL guy had set up the following scheduled job with the TSQL statement:
BACKUP LOG DEV TO DevDailyTranLog with noinit
This runs every 20 minutes.
There's also a Maint Plan to do a Complete backup every night and a
Transaction Backup every hour (could be set to 20 min)
Why do you suppose the BACKUP LOG job exists ? If the maint plan were
set to backup transaction every 20 min, wouldn't the 2 jobs be
duplicating each other ?
Also, I notice that the Tran Logs specified in the database properties
seem awfully big (4 gig), shouldn't they automatically be truncated when
the daily full backup occurs ? (full recovery model)
Feel free to call me and straighten me out or to get more info.
Win2K, SQL 2K
gdunn@taunton.com
203-426-8171 x 374
View 2 Replies
View Related
Apr 3, 2008
Help!
I have a bcp that create an extra line at the end of the file--how do u fix--
bcp "select upload_data FROM %DRI_DB%.dbo.chf_upld_wkstn" queryout %DATA_DIR%test.txt -S %DRI_SERVER% -U %DRI_USERID% -P %DRI_PW% -c
Josephine
View 1 Replies
View Related