2012年3月29日星期四
Floating point exception
what is the problem? how can I fix it?
DBCC INDEXDEFRAG (0, table1, 2)
Server: Msg 3628, Level 16, State 1, Line 1
A floating point exception occurred in the user process. Current transaction
is canceled.With all the problems you've been having, my suggestion would be to create
your database over again from scratch.
"Britney" <britneychen_2001@.yahoo.com> wrote in message
news:%23S7$KOjjFHA.2444@.tk2msftngp13.phx.gbl...
> Hi guys,
> what is the problem? how can I fix it?
>
> DBCC INDEXDEFRAG (0, table1, 2)
>
> Server: Msg 3628, Level 16, State 1, Line 1
> A floating point exception occurred in the user process. Current
> transaction
> is canceled.
>|||Britney wrote:
> Hi guys,
> what is the problem? how can I fix it?
>
> DBCC INDEXDEFRAG (0, table1, 2)
>
> Server: Msg 3628, Level 16, State 1, Line 1
> A floating point exception occurred in the user process. Current
> transaction is canceled.
What version of SQL Server are you using?
David Gugick
Quest Software
www.imceda.com
www.quest.com|||..818
I think it's because corrupted data.
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:eKHiWTjjFHA.3656@.TK2MSFTNGP09.phx.gbl...
> Britney wrote:
> What version of SQL Server are you using?
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
float vs decimal
1233400.0
select convert(decimal(20,2),'1.2334e+006')
Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
Is there any way around?
Is there any set options? I tried arithabort or arithignore and they
don't work.
Thanks.(othellomy@.yahoo.com) writes:
Quote:
Originally Posted by
select convert(float,'1.2334e+006')
1233400.0
>
select convert(decimal(20,2),'1.2334e+006')
Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
>
Is there any way around?
Is there any set options? I tried arithabort or arithignore and they
don't work.
1.2334e+006 is not a legal literal for decimal. You will have to convert
in two steps, first to float, then to decimal.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Am 21 Nov 2006 22:09:05 -0800 schrieb othellomy@.yahoo.com:
Quote:
Originally Posted by
select convert(float,'1.2334e+006')
1233400.0
>
select convert(decimal(20,2),'1.2334e+006')
Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
>
Is there any way around?
Is there any set options? I tried arithabort or arithignore and they
don't work.
Thanks.
select convert(decimal(20,2),cast('1.2334e+006' as float))
bye,
Helmut
2012年3月27日星期二
flatten out a normalized child table?
table so I can get their address on a single line/row of data. The Column
names are not importat in that final flat file, just what was in
row1,2,3,...6
GARY C Test Row1
LISA C Test Row2
816 RIVERVIEW PLACE Row3
WASHINGTON, MO 63090 Row4
Row5
Row6
THOMAS H Other-Test Row1
2102 N SHAMROCK RD Row2
BEL AIR, MD 21014 Row3
Row4 ,etc.
I have to account for double names names, and possibably titles, Suite #,
etc.
TIAPlease post DDL with your sample data. What is the key of the table you
posted? What relates the address lines together to make a single
address? Apparently nothing links an address together in the sketch you
posted except for the order in which you typed them out. We know that
tables have no fixed order so it isn't possible to combine the rows
reliably to make addresses out of each one.
If you had an additional column such as contact_name or contact_no for
each address line then you could do something like:
SELECT MAX(CASE WHEN row_num = 1 THEN addr END),
MAX(CASE WHEN row_num = 2 THEN addr END),
MAX(CASE WHEN row_num = 3 THEN addr END),
... etc
FROM your_table
GROUP BY contact_name ;
Hope this helps.
David Portas
SQL Server MVP
--|||"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1129058354.597302.39690@.g44g2000cwa.googlegroups.com...
> Please post DDL with your sample data. What is the key of the table you
> posted? What relates the address lines together to make a single
> address? Apparently nothing links an address together in the sketch you
> posted except for the order in which you typed them out. We know that
> tables have no fixed order so it isn't possible to combine the rows
> reliably to make addresses out of each one.
> If you had an additional column such as contact_name or contact_no for
> each address line then you could do something like:
> SELECT MAX(CASE WHEN row_num = 1 THEN addr END),
> MAX(CASE WHEN row_num = 2 THEN addr END),
> MAX(CASE WHEN row_num = 3 THEN addr END),
> ... etc
> FROM your_table
> GROUP BY contact_name ;
Thanks
2012年3月22日星期四
Flat file produced but need line returns
My Integration Services creates a flat file using OLE DB Source and then a Flat File Destination. The flat file is created from data from my data source with is just a table with many rows.
Each row in my flat file .txt is appended onto each other, there are no line returns after each record. How can I put in a return after each row in my flat file that is outputted from the Flat File Destination component in conjunction with the properties in my Flat File Connection Manager. What am I missing here in order to ensure each row from my table creates a carriage return in my .txt flat file?
The column separator for your last column need to be {CR}{LF}
HTH,
Ovidiu
In my File Connection Manager, I have {CR}{LF} for the header row delimeter but it's not putting a return at the end of each row in my flat file still.
I do not have a header row since this is coming straight from the table so I don't understand why the requirement to specify header information in the File Connection Manager at this point but it is required.
So I'm not sure what else I'm missing, my flat file still doesn't return each row, it appends each row right after another still.
|||I see what you're saying, put{CR}{LF}
in the column delimeter for the last column's properties, is this correct? If so, I can't that property is greyed out (because it doesn't need it when specifying a flat file) when I click on the last column in the Advanced Tab of the File Connection Manager.
I just don't see where to specify the row delimeters after looking at all the tabs.
|||Here's my flat file, still doesn't have carriage returns:
http://photopizzaz.biz/junk/flat_file.txt
|||What format are you using for your flat file? You should use RaggedRight if you want carriage returns at the end of your row.|||The file needs to be a fixed format of 100 bytes. It needs to be formatted like this:
http://www.photopizzaz.biz/junk/final_flat_file.txt
It has to have line carriages just like this one.
|||Ranjeeta , you just made my day, thank you! it was so obvious but I had no clue!|||I had trouble figuring that out too and found the ragged-right solution on my own. But I have a different problem now. I specified a multi-line header in the flat-file destination component, but the text file produced only uses the line-endings of the header when viewed in WordPad or some other advanced text editor.Notepad only shows little boxes and this make the header useless.
How do I get a real line-ending into the file at the end of each of my header lines so that notepad will display it properly?
Thanks!|||Don't use notepad. Try VIM, or wordpad, or TextPad or something like that. Notepad is a "dumb" editor and can't handle too many special characters.|||That particular solution is already in place. Some of my users are stubborn. You know how that goes. Notepad is their friend... In any case, there are a large number of less savvy software packages out there that will have the same trouble as notepad, and it would be nice for everyone using SSIS to be able to produce flat files that they can consume.
TextPad is what I generally use. Wordpad works too.
Thanks though.|||Right, but Notepad only processes CR-LF line terminations. If a line terminates with LF, it won't display correctly in Notepad. You can't do anything about that, unless you issue a CR-LF.
Flat file produced but need line returns
My Integration Services creates a flat file using OLE DB Source and then a Flat File Destination. The flat file is created from data from my data source with is just a table with many rows.
Each row in my flat file .txt is appended onto each other, there are no line returns after each record. How can I put in a return after each row in my flat file that is outputted from the Flat File Destination component in conjunction with the properties in my Flat File Connection Manager. What am I missing here in order to ensure each row from my table creates a carriage return in my .txt flat file?
The column separator for your last column need to be {CR}{LF}
HTH,
Ovidiu
In my File Connection Manager, I have {CR}{LF} for the header row delimeter but it's not putting a return at the end of each row in my flat file still.
I do not have a header row since this is coming straight from the table so I don't understand why the requirement to specify header information in the File Connection Manager at this point but it is required.
So I'm not sure what else I'm missing, my flat file still doesn't return each row, it appends each row right after another still.
|||I see what you're saying, put{CR}{LF}
in the column delimeter for the last column's properties, is this correct? If so, I can't that property is greyed out (because it doesn't need it when specifying a flat file) when I click on the last column in the Advanced Tab of the File Connection Manager.
I just don't see where to specify the row delimeters after looking at all the tabs.
|||Here's my flat file, still doesn't have carriage returns:
http://photopizzaz.biz/junk/flat_file.txt
|||What format are you using for your flat file? You should use RaggedRight if you want carriage returns at the end of your row.|||The file needs to be a fixed format of 100 bytes. It needs to be formatted like this:
http://www.photopizzaz.biz/junk/final_flat_file.txt
It has to have line carriages just like this one.
|||Ranjeeta , you just made my day, thank you! it was so obvious but I had no clue!|||I had trouble figuring that out too and found the ragged-right solution on my own. But I have a different problem now. I specified a multi-line header in the flat-file destination component, but the text file produced only uses the line-endings of the header when viewed in WordPad or some other advanced text editor.Notepad only shows little boxes and this make the header useless.
How do I get a real line-ending into the file at the end of each of my header lines so that notepad will display it properly?
Thanks!|||Don't use notepad. Try VIM, or wordpad, or TextPad or something like that. Notepad is a "dumb" editor and can't handle too many special characters.|||That particular solution is already in place. Some of my users are stubborn. You know how that goes. Notepad is their friend... In any case, there are a large number of less savvy software packages out there that will have the same trouble as notepad, and it would be nice for everyone using SSIS to be able to produce flat files that they can consume.
TextPad is what I generally use. Wordpad works too.
Thanks though.|||Right, but Notepad only processes CR-LF line terminations. If a line terminates with LF, it won't display correctly in Notepad. You can't do anything about that, unless you issue a CR-LF.
flat file destination -data all on one line
I have a flat file destination that Im sending data to, from an OLE DB data source. There are two records, but for some reason they are both going on the same line in the output. This is after setting the output to fixed width, from comma delimited.
Help ?
If you are viewing the flat file from a text editor, recheck the option on your editor to verify word wrap is not occurring. The file may be perfectly fine, it's the representation in the editor.|||If you are using the pure FixedWidth format the row delimiter is not going to be inserted. It assumes all your columns are fixed width and it does not put any delimiters.
If you want to break your rows in new lines, choose the Fixed Width with Row Delimiters option at the time you create the flat file connection from the Flat File Destination. This will configure the connection to use the RaggedRight format and add a dummy column with the new line delimiter at the end. You should be able to do this manually as well, if you are changing an existing connection.
HTH.
2012年3月21日星期三
Flat file (CSV) source format
I have a SSIS package loading a lot of CSV file, which first line is the column head. Some file are ordered differently. However, package still try to load the file use predefined column order (it seems it doesn't check the head of each file see if it matchs the predefined column order).
Any way to force the package the check each file's head? or I had to manually check it using VB.Net script?
No, the Flat File connection manager cannot adapt to dynamic file formats. You can workaround with script. These threads should be helpful.http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1408850&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1438953&SiteID=1
2012年3月7日星期三
First() and last() function -> course says yes, Book on line says no
> Could they make that big a mistake?
Apparently so :-)
Chief Tenaya
"Richard Fagen" <no_spam@.my_isp.com> wrote in message
news:eGRLEejHEHA.3464@.TK2MSFTNGP10.phx.gbl...
> Hi Everyone,
> I'm taking an online course to learn more about SQL. I found this great
> site...
> http://www.w3schools.com/sql/default.asp
> In one of the lessons, it mentions SQL server's functions. However,
> when I tried it, it doesn't work. I checked the Books online and it
> appears there is no such function. Could they make that big a mistake?
> I know there are other ways of doing the same thing but I found the site
> very accurate and this surprises me.
> Here is the page in question. The problems: it claims there is a First
> (and Last) function...
> http://www.w3schools.com/sql/func_first.asp
> -- here is their example
> "The FIRST function returns the value of the first record in the
> specified field.
> Tip: Use the ORDER BY clause to order the records!
> Syntax
> SELECT FIRST(column) AS [expression]
> FROM table
> Example
> SELECT FIRST(Age) AS lowest_age
> FROM Persons
> ORDER BY Age"
You need the TOP modifier. eg.
SELECT TOP 1 Age AS lowest_age
FROM Persons
ORDER BY Age
HTH,
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com
"Richard Fagen" <no_spam@.my_isp.com> wrote in message
news:eGRLEejHEHA.3464@.TK2MSFTNGP10.phx.gbl...
> Hi Everyone,
> I'm taking an online course to learn more about SQL. I found this great
> site...
> http://www.w3schools.com/sql/default.asp
> In one of the lessons, it mentions SQL server's functions. However,
> when I tried it, it doesn't work. I checked the Books online and it
> appears there is no such function. Could they make that big a mistake?
> I know there are other ways of doing the same thing but I found the site
> very accurate and this surprises me.
> Here is the page in question. The problems: it claims there is a First
> (and Last) function...
> http://www.w3schools.com/sql/func_first.asp
> -- here is their example
> "The FIRST function returns the value of the first record in the
> specified field.
> Tip: Use the ORDER BY clause to order the records!
> Syntax
> SELECT FIRST(column) AS [expression]
> FROM table
> Example
> SELECT FIRST(Age) AS lowest_age
> FROM Persons
> ORDER BY Age"
First() and last() function -> course says yes, Book on line
I guess that's what they meant by each flavour of SQL can have slightly
different syntax and to check with the manuals.
Thanks for confirming it.
Richard
Tenaya wrote:
> Richard,
>
>
> Apparently so :-)
> Chief Tenaya
Hi Greg,
This sounds like it should work. I checked Book Online but can't find
any mention of the top modifier ... aside from inside the complicated
full explaination of the SELECT statement. Is this what you meant?
I never realized who powerful (and complicated) the SELECT statement is
Thanks for your help
Richard
From Books Online's select (described)
...
< query specification > ::=
SELECT [ ALL | DISTINCT ]
[ { TOP integer | TOP integer PERCENT } [ WITH TIES ] ]
< select_list >
[ INTO new_table ]
[ FROM { < table_source > } [ ,...n ] ]
[ WHERE < search_condition > ]
[ GROUP BY [ ALL ] group_by_expression [ ,...n ]
[ WITH { CUBE | ROLLUP } ]
]
[ HAVING < search_condition > ]
Greg Low (MVP) wrote:
> You need the TOP modifier. eg.
> SELECT TOP 1 Age AS lowest_age
> FROM Persons
> ORDER BY Age
> HTH,
2012年2月19日星期日
FireEvent issues with Reporting Services
command line:
rs.exe -i MyScriptFile.rss -s "MyReportServer/ReportServer"
The input scriptfile (MyScriptFile) contains the lines below where the scheduleID is taken from Reporting Services from an existing 'once only' schedule. The schedule, - when triggered - should fire off a subscription and email recipients with a particular existing report.
Sub Main
Dim rs As New ReportingService()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.FireEvent("TimedSubscription", "87206163-7665-4458-a86c-75b84cf18b2d")
End Sub
Unfortunately, it doesn't work and I almost always get the response:
Unhandled exception:
The request failed with HTTP status 404: Not Found.
If I comment out the line rs.FireEvent( . . . from the script then the command line runs successfully. I can only conclude that there appears to be something wrong with this particular line.
Any ideas anyone?
Kev
Rs.exe takes care of creating the proxy to SSRS and doing authentication, so the first two lines of code (Dim RS & rs.Credentials) aren't actually necessary. The rest of your code looks fine, though.
You're saying that it sometimes does work?
Here are a few things to try:
- Can you check your Subscription ID to make sure it actually exists?
- Does this code work against a Subscription ID directly (in code) from a different (known good) subscription? (For example, see if this sample works: http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.reportingservice2005.fireevent.aspx)
- FireEvent is the only method you're actually firing against the SOAP API...why don't you include another before you call FireEvent (something simple like ListChildren()) to make sure that the web service can do *any* work on your behalf.
- I've never seen someone specify the server name in their command-line w/o appending http:// first. This mean it won't work, I've just never seen it. Can you try something like this: rs.exe -i myFile.rss -s http://localhost/reportserver -u myDomain\myAccount -p myPassword ? Do this after you remove the first two lines of your code.
Let us know...good luck!
|||Russell, Thanks tremendously for the reply! I spent two whole days on this (without success) trying every variation I could think of.Firstly, no the code in the original post has never worked; I've not been able to trigger anything. The Subscription ID definitely exists however: I highlighted it and copied it from within the Reporting Services address bar (in the Scheduling page) directly making sure I had it perfect. I did wonder whether it 'was' the intended ScheduleID but the address bar in the browser reads:
http://MyServer/Reports/Pages/Schedule.aspx?ScheduleID=87206163-7665-4458-a86c-75b84cf18b2d
. . . so I am assuming that I really 'do' indeed have the correct ScheduleID it's looking for (87206163-7665-4458-a86c-75b84cf18b2d)? Or is it? I've tried this with double quotes, without quotes, with single quotes all with no luck.
Secondly, the code below works perfectly indicating that the SOAP API will indeed do something for me:
rs.exe -i ListFormatExtensions.rss -s "MyServer/ReportServer"
with the following code in the ListFormatExtensions.rss file:
Sub Main
For Each Ext As Extension In rs.ListExtensions(ExtensionTypeEnum.Render)
Console.WriteLine(Ext.Name)
Next
End Sub
Strangely, ListChildren (as you suggested) didn't work at all? It failed with error BC30451: Name 'ListChildren' is not declared. I would assume that this is something perhaps due to the fact that I am using Reporting Services 2000 and not 2005? The actual failed code I used in the rss file was:
Sub Main
Dim rs As New ReportingService()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.ListChildren()
rs.FireEvent("TimedSubscription", "87206163-7665-4458-a86c-75b84cf18b2d")
End Sub
The server name also works either way I specify it with the ListFormatExtensions test. So both these code snippets work happily and there's no issue with username and password:
rs.exe -i ListFormatExtensions.rss -s "MyServer/ReportServer"
rs.exe -i ListFormatExtensions.rss -s http://MyServer/ReportServer
I tried the option you suggested (without the first two lines of code) which it didn't like:
Sub Main
FireEvent("TimedSubscription", "87206163-7665-4458-a86c-75b84cf18b2d")
End Sub
error BC30451: Name 'FireEvent' is not declared
. . . so I promptly put the first two lines back in.
I am still trying to figure out what you mean by - Does this code work against a Subscription ID directly (in code) from a different (known good) subscription? (For example, see if this sample works: http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.reportingservice2005.fireevent.aspx)
The web address you gave simply takes me straight to the MSDN definition for FireEvent in Reporting Services 2005.
Kev
|||
Hey Kev --
Even though you can remove "Dim RS", etc. you still use "rs.Whatever" in your code
This worked for me:
1. Created a new subscription off the Adventure Works - Company Sales report: Used the fileshare delivery extension because I don't have an SMTP server handy
2. Put it on a schedule that would not fire until 3 days from now
3. Executed select * from reportserver..subscriptions to get the Subscription ID
4. Threw code below in an RSS file:
Sub Main()
Try
rs.FireEvent("TimedSubscription", "E34849EE-63EE-4BF6-957F-55A9B1132DDB")
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
5. In Report Manager, made sure that my user had "Generate Events" permissions (a system permission)
6. Executed the code with rs.exe -i c:\tryme.rss -s http://servername/reportserver
7. Checked my fileshare, found the report sitting there.
Yes, make sure that you are using the subscription ID, as Russell is, and not the schedule ID that you said you were using.
-Daniel
|||Guys, thanks for your input!! The problem is now sorted.
Unfortunately, I never gave a thought to the fact that I was running the rs.exe command on my own desktop and not the server on which Reporting Services is actually installed ! Dumb hey! When I put the file TriggerReport.rss on the report server and then ran the command to execute on the report server itself (using the psexec command):
psexec \\myserver rs.exe -i C:\TriggerReport.rss -s "http://myserver/ReportServer"
. . . it triggered the report immediately. The report promptly arrived in my email. I guess the lesson here is to stand back often and ask yourself if you're doing anything obviously stupid before blaming the code.
Kev
|||What Imports do you need for your .NET app if using SSRS 2005? Just thought I'd ask since you guys are the only place I've found really good info on this subject.