CLR Function - Invalid Character In The Given Encoding
Dec 18, 2006
Hello!
I wrote a CLR function, which is receiving some XML parameters. In certein situations it gives me the following error message:
Msg 6522, Level 16, State 1, Line 58
A .NET Framework error occurred during execution of user-defined routine or aggregate "svmScale":
System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 27.
System.Xml.XmlException:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlWriter.WriteNode(XmlReader reader, Boolean defattr)
at System.Data.SqlTypes.SqlXml.CreateMemoryStreamFromXmlReader(XmlReader reader)
at System.Data.SqlTypes.SqlXml..ctor(XmlReader value)
at UserDefinedFunctions.svmScale(SqlXml sql_problem, Boolean perChannel, Single x_factor, Single y_factor)
If I cahnage one of the zeros in the given tag, the error message disappears. If i cut the given tag, the error message disappears. If I cut the given tag, and then paste the previous one in place of it, the error message APPEARS. So my conclusion is, that any tag can be wrong on a specific position in the XML. This makes me wonder.
Another wonderfull thing is, that if I take this CLR function, and the same TSQL code, and I do run it on my notbook with my SQL Express, no error message. But if I try to use it on the server, with SQL 2005 it drops me this error message. The resulting XML is coming from an SELECT FOR XML AUTO, so i suspect it not having illegal characters inside. This is probably true, becouse the above replace procedure can make the message disapear.
The server:
Product: Microsoft SQL Server Enterprise Edition
Op System: Microsoft Windows NT 5.2 (3790)
Platform: NT INTEL X86
Version: 9.00.3027.00
Language: English (United States)
Memory: 4095 (MB)
Processors: 2
Collation: SQL_Latin1_General_CP1_CI_AS
Clustered: False
The notebook:
Product: Microsoft SQL Server Express Edition
Op System: Microsoft Windows NT 5.1 (2600)
Platform: NT INTEL X86
Version: 9.00.1399.06
Language: English (United States)
Memory: 1015 (MB)
Processors: 1
Collation: SQL_Latin1_General_CP1_CI_AS
Clustered: False
I have a user who is using data from my database for a webportal. One of my tables had a field that was type NText. The technology he is using couldn't cope with NText so i changed the data type to nvarchar instead. The user is now getting some superfluous characters coming back as part of the data in the field e.g. '12 ' where a space appears if looking at the data through something like Query Analyser. He was asking if I could change the character encoding to Unicode.
I thought that datatypes like Nvarchar were unicode anyway but I guess the fact that I changed the type might mean that I need to explicitly declare it as unicode. Does anyone know if this is the case?
I've seen a dump of the TDS traffic going from my webserver to the SQLServer database and it seems encoded in Unicode (it has two bytes perchar). Seems it would have a huge impact on performance if ittravelled in one byte. Why might this be?rj
I'm storing data in SQL Server 2005 Express ntext fields. I've added <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> to the Master Page, but apostrophes and other characters are appearing incorrectly in the browser. For example, apostrophes are appearing as Æ. They seem to have changed to this when I upsized from Access to SQL Server (so I have Æ in the db field).The back-end of the site is still in classic asp, where I can set the CodePage to 65001 and the CharSet to utf-8, and everything appears fine there. What can I change in the ASPX to get characters to display correctly?
I want to insert a value which has the UTF-8 encoding into a field of the database which has the "text" data Type but it saves like this : " ?????????????? "
I would be thankful if u tell me how should I save it ? here is the SqlComand I wrote :
Trying to generate a report (using WebForm ReportViewer, from dynamically created RDL report and SQL Server 2005 OLAP cube), if a database field contains control characters (code < 0x20), Reporting Services generate following message:
' ', hexadecimal value 0x02, is an invalid character. Line 1, position 2376.
Is it possible to ignore that? I don't care if browser shows an octopus, the report must work.
I'm getteing an error saying "[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification" when i try to debug a store procedure. The Store Procedure parameters are as below. PROCEDURE clCreateUnpostedTrxEarnType ( @SERIES int, @PERIODID int, @YEAR int, @PTRATIO float, @CPTYPE int, @CPTRXTYPE int, @Startdate datetime, @Enddate datetime, @O_iErrorState int = NULL output )
I am using the backend SQLServer with Powerbuilder, I write a stored procedure and tried to create a datawindow to use that procedure but failed, it returns error code 22005 -Invalid Character value for cast specification. I tried to change any setting in ODBC but still failed.
accessing through ODBC a frond end application which is running on MS SQL Server 2005, works just fine with a specific setup as concerned as the decimal/thousands separators ("," for thousands and "." for decimals). If i switch these settings alternatively ("." for thousands and "," for decimals), i get this error: [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification.
I tried to search forum and internet but no luck. Thanks in advance
hello, i have a problem with SQL Server Agent. Sometimes, when a scheduled job runs i get this error:
Error: 2008-03-13 06:04:50.50 Code: 0xC0202009 Source: Load Current OLE DB Destination [124] Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification". End Error Error: 2008-03-13 06:04:50.52 Code: 0xC020901C Source: Load Current OLE DB Destination [124] Description: There was an error with input column "collectDate" (217) on input "OLE DB Destination Input" (137). The column status returned was: "Conversion failed because the data value overflowed the specified type.". End Error Error: 2008-03-13 06:04:50.52 Code: 0xC0209029 Source: Load Current OLE DB Destination [124]
the code i use looks like this
DECLARE @Report_date datetime SET @Report_date = dateadd(dd,-1,convert(varchar(10),getdate(),121))
select CollectDate = @Report_date
the destination column is datetime. Is this a known issue / bug? Because this doesn't happen everytime, and when it does happen all i have to do ia run the job again.
I have a Data Flow task that is simply copying data from table A to table B. (there is a derived column in between however)
All the columns in table A are varchar(255). The columns in table B vary: floats, decimals, etc
However, I am getting a bazillion errors when I run this, each of them to the effect that:
Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification". An OLE DB record is available. Source: "Microsoft SQL Native Client"
I don't understand why this is happening... I've succesfully run similar scenarios with other packages, ie) moving data from one table to another table even though the tables have different data types.
if the variable contains any of the character  that is not present in the  following Below table then it should display "InValid Character" else "valid Character"
DECLARE @MyString VARCHAR(100) SET @MyString = 'ABC$[' select caseÂ
I'm usung bcp to move data from one table to another. 202 million rows. The source/original table had 32 fields. The new table has 33 fields. I added a PK column to the destination/new table. The new PK column is the first field in the new table, it is set to autoincrement by 1 on each insert. The data file only has 32 fields of data per row.
The error is :SQLState = 22018, NativeError = 0 Error = [Microsoft][SQL Native Client]Invalid character value for cast specification
10 times, then bcp shuts off (default errors is 10).
C:>bcp dbname.schema.TP_LOG_NEW in e:alltplog.dat -S dbsvr -T -f tplognew.fmt
I'm working on a database conversion from Sybase to SQL Server 2005 and have hit a wall with a character conversion problem when reading non-ASCII characters (encrypted password string) via JDBC.
My application runs on Solaris and accesses a SQL Server 2005 database via the Microsoft JDBC driver. The server was unfortunately specified as having a SQL_Latin1_General_CP1_CI_AS collation at installation time, and the database being accessed has taken this default. After creation the data was migrated across via DTS.
The invalid character is a dagger '†'. When read over JDBC it is converted to a question mark '?'.
In my original environment a Sybase database was accessed via JDBC driver from Solaris and the correct value was returned. The Sybase database used Latin1_General_BIN as it's collation. By way of experimentation I have modified the default collation sequence within the SQL Server 2005 database, and created a new table to hold the password. I am then able to correctly return strings containing this character from within SQL Server Management Studio, but the same problem still exists when accessing it via JDBC.
I am not sure where to focus my investigation and would be grateful for any useful pointers/advice. To me it looks like it's a JDBC driver issue as with the change in collation it works from a non-JDBC client.
I have a question regarding the running of a procedure from VC++ in SQL server.
well this is the scenario.
i have a procedure in SQL server and i am running that thru my VC++ code. :eek: i have a recordset class and i create an object of it and then do a obj.Open(). the procedure is fetching 24 records correctly in the query analyser and in my while(!(obj.IsEOF())) loop it gets the first record correctly but the moment it encounters obj.MoveNext(); it bombs and gives me the following error..
"Invalid Character value for cast specification ".
Hi,I used SQL Server 2000 Personal Edition. I created a stored procedurehaving input parameters as smallint,tinyint,char,varchar andsmalldatetime. When I executed it by Query Analyzer, it's ok. But whenI executed it by ASP code that used ADODB.command, it showed error:Invalid character value for cast specification .Though SQL Server debugger, it showed:[Microsoft][ODBC SQL Server Driver]Invalid character value for castspecificationWhat did I do wrong? How do I fix this problem?TIAKrungPS: One of input parameters was smalldatetime, but I casting it in ASPas date as:Const adDate=7datetxt='2004/6/28'cmd.Parameters.Append cmd.CreateParameter("CoopId",adChar,adParamInput, 8, coopid)cmd.Parameters.Append cmd.CreateParameter("Addr",adVarChar,adParamInput, 100, addr)...cmd.Parameters.Append cmd.CreateParameter("Cdate",adDate,adParamInput, , datetxt)....cmd.execute
Hi, I'm a new DBA and am a rookie when it comes to working with SQL Server 2005. I have been tasked with transfering an Access database to SQL Server 2005. Now I understand to use the import/export wizard, but am having problems fixing an error I am receiving. Here is the error...
Problem I - Copying to [IS_Shared_ServicesTest].[dbo].[tblResource] (Error) Messages * Error 0xc0202009: Data Flow Task: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification". (SQL Server Import and Export Wizard)
* Error 0xc020901c: Data Flow Task: There was an error with input column "Contract Start Date" (115) on input "Destination Input" (80). The column status returned was: "Conversion failed because the data value overflowed the specified type.". (SQL Server Import and Export Wizard)
Here is the short version of the error. I realize that there is an error with the conversion and the error is in tblResource in column Contract Start Date. It is still transfering the column over, and on spot check they seem fine. Should I be really worried about an error? Or is there something that I can do with the Access or SQL server database to fix this?
In my SSIS Package I am loading data from Oracle source to SQL Destination. But while loading I am getting below error.
[OLE_DST_FORECASTSTANDARD [72]] Error: SSIS Error Code DTS_E_OLEDBERROR. Â An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Â Source: "Microsoft SQL Server Native Client 11.0" Â Hresult: 0x80004005 Â Description: "Invalid character value for cast specification".
[OLE_DST_FORECASTSTANDARD [72]] Error: There was an error with OLE_DST_FORECASTSTANDARD.Inputs[OLE DB Destination Input].Columns[UNITS_NEW] on OLE_DST_FORECASTSTANDARD.Inputs[OLE DB Destination Input].
The column status returned was: "Conversion failed because the data value overflowed the specified type.".
I have attached the table definition of both source as well as destination.
My source is a csv flat file. Currently I use that same flat file on SQL 2000 and SQL 2005.
On SQL 2000 it runs fine and it inserts that character as part of the string (varchar), however, it gives me truncate error on sql 2005. I already use the "Suggest Types...." and my Output columns have the correct lenght (specially that lehght of that column is only 30 char which is less than the default anyways). If I remove that character it runs fine for that column.....
This is the values that I get in my flat file for the trouble coulmn is "ATTN: JON OLSEN €€œ CTRL8 "
And the error that I get when running the SSIS is
[Flat File Source OrderDetail [1]] Error: Data conversion failed. The data conversion for column "Column 15" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
[Flat File Source OrderDetail [1]] Error: The "output column "ShipToAddr1" (63)" failed because truncation occurred, and the truncation row disposition on "output column "ShipToAddr1" (63)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
[Flat File Source OrderDetail [1]] Error: An error occurred while processing file "C:Inetpubftprootorderdetail.csv" on data row 6.
I'm working on a database conversion from Sybase to SQL Server 2005 and have hit a wall with a character conversion problem when reading non-ASCII characters (encrypted password) via JDBC.
My application runs on Solaris and accesses a SQL Server 2005 database via the Microsoft JDBC driver. The server was unfortunately specified as having a SQL_Latin1_General_CP1_CI_AS collation at installation time, and the database being accessed has taken this default. After creation the data was migrated across via DTS.
The invalid character is a dagger '€ '. When read over JDBC it is converted to a question mark '?'.
In my original environment a Sybase database was accessed via JDBC driver from Solaris and the correct value was returned. The Sybase database used Latin1_General_BIN as it's collation. By way of experimentation I have modified the default collation sequence within the SQL Server 2005 database, and created a new table to hold the password. I am then able to correctly return strings containing this character from within SQL Server Management Studio, but the same problem still exists when accessing it via JDBC.
I am not sure where to focus my investigation and would be grateful for any useful pointers/advice. To me it looks like it's a JDBC driver issue as with the change in collation it works from a non-JDBC client.
Hello, I am running out of ideas on how to get SSRS to work. I am trying get this setup with the intention to replace our Crystal Reports server. Currently I have set up the RS Virtual Directory on a Win XP box. The ReportServer database sits on another SQL2000 box.
I can connect to the http://localhost/ReportServer/ on the XP box to display the page the depicts "Microsoft SQL Server Reporting Services Version 9.00.2047.00"
When I connect to the http://localhost/Reports/, I get this error "A name was started with an invalid character. Error processing resource 'http://leej/Reports/'. Line 1, Position 2" I checked my IIS Virtual Directory properties for Reports and ASP.NET is set to v2.0.50727. I also executed "aspnet_regiis.exe -i" in the "C:WINDOWSMicrosoft.NETFrameworkv2.0.50727" directory.
Any thought on how to fix this? I hate to let this blocker deters us from deploying SSRS.
Hi all--Given a table called "buyers" with the following column definitions in a SQL Server 2005 database:
[BUYER] [nvarchar](40) NULL,
[DIVISION] [nvarchar](3) NULL,
[MOD_DATE] [datetime] NULL
This table is laden with Unicode data and the MOD_DATE contains no data--not even NULL values, and is giving me a headache as a result. I can export this data fine to a text file, but when I create an SSIS package to attempt import to another table defined exactly the same as above in another place, I get the following messages:
SSIS package "buyers_import.dtsx" starting. Information: 0x4004300A at Data Flow Task, DTS.Pipeline: Validation phase is beginning. Information: 0x4004300A at Data Flow Task, DTS.Pipeline: Validation phase is beginning. Information: 0x40043006 at Data Flow Task, DTS.Pipeline: Prepare for Execute phase is beginning. Information: 0x40043007 at Data Flow Task, DTS.Pipeline: Pre-Execute phase is beginning. Information: 0x402090DC at Data Flow Task, Source - buyers_txt [1]: The processing of file "D: emp3uyers.txt" has started. Information: 0x4004300C at Data Flow Task, DTS.Pipeline: Execute phase is beginning. Information: 0x402090DE at Data Flow Task, Source - buyers_txt [1]: The total number of data rows processed for file "D: emp3uyers.txt" is 232. Error: 0xC0202009 at Data Flow Task, Destination - buyers_tst [22]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification". Error: 0xC020901C at Data Flow Task, Destination - buyers_tst [22]: There was an error with input column "MOD_DATE" (45) on input "Destination Input" (35). The column status returned was: "The value could not be converted because of a potential loss of data.". Error: 0xC0209029 at Data Flow Task, Destination - buyers_tst [22]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (35)" failed because error code 0xC0209077 occurred, and the error row disposition on "input "Destination Input" (35)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - buyers_tst" (22) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure. Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread0" has exited with error code 0xC0209029. There may be error messages posted before this with more information on why the thread has exited. Information: 0x40043008 at Data Flow Task, DTS.Pipeline: Post Execute phase is beginning. Information: 0x402090DD at Data Flow Task, Source - buyers_txt [1]: The processing of file "D: emp3uyers.txt" has ended. Information: 0x402090DF at Data Flow Task, Destination - buyers_tst [22]: The final commit for the data insertion has started. Information: 0x402090E0 at Data Flow Task, Destination - buyers_tst [22]: The final commit for the data insertion has ended. Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning. Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination - buyers_tst" (22)" wrote 0 rows. Task failed: Data Flow Task SSIS package "buyers_import.dtsx" finished: Failure.
Among the customizations in this package is the flag "ValidateExternalMetadata" set to False. The data itself is surrounded by " and delimited by semicolons for each field, with the header row set as the name of each column. It looks like this:
"BUYER";"DIVISION";"MOD_DATE" "108 Joon-Hyn Kim";"TAD";"" "109 Kang-Soo Do";"TAD";"" "FS07 John Smith";"TAD";""
...
Can anyone suggest a course of action on how to handle the error when the MOD_DATE field is completely empty?
I have OLE DB source which executes SP with 2 parameters and output is flat file. Every time I run I immediately get output below. How do I troubleshoot further what might be causing this?
Information: 0x402090DC at Data Flow Task, Flat File Destination [2]: The processing of file "C:UsersadminDesktopout.csv" has started. Error: 0xC0202009 at Data Flow Task, OLE DB Source [41]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E21 Description: "Invalid character value for cast specification". Error: 0xC004701A at Data Flow Task, SSIS.Pipeline: OLE DB Source failed the pre-execute phase and returned error code 0x80040E21.
I am using ASPOSE License(3rd party licensing tool).
Getting Error when using encrypted License file (*.lic) in my Application .
Error is .
"Invalid character in a Base-64 string "
What does it means ?????
But Demo License file *.lic is working fine.
Please provide solutions.
Reply is highly appreciated.
Rishi
Error is Invalid character in a Base-64 string.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Invalid character in a Base-64 string.
Source Error:
Line 59: Line 60: //license = new Licensing("Ghezt4vbwif7r9cf7ra2ttbKzv76+v7GAA==", licenceFile); Line 61: license = new Licensing("Ghezt4vbwif7r9cf7ra2ttbKzv76+v==", licenceFile); Line 62: Line 63: Source File: c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseApp_CodeDemo.cs Line: 61
Stack Trace:
[FormatException: Invalid character in a Base-64 string.] System.Convert.FromBase64String(String s) +0 Aspose.License.Licensing.M0(String key, String encryptedString) +627 Aspose.License.Licensing.A0() +753 Aspose.License.Licensing..ctor(String key, String licenseFile) +72 Demo.Initialize() in c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseApp_CodeDemo.cs:61 Demo..ctor(String licenseFolder, Page page) in c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseApp_CodeDemo.cs:37 _Default.Page_Load(Object sender, EventArgs e) in c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseDefault.aspx.cs:18 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68 System.Web.UI.Control.OnLoad(EventArgs e) +88 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3035
Why would I get these errors: " SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E21 Description: "Invalid character value for cast specification".
There was an error with input column "UniqueID" (3486) on input "OLE DB Command Input" (3438). The column status returned was: "The value could not be converted because of a potential loss of data.".
Error: 0xC0209029 : SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "OLE DB Command Input" (3438)" failed because error code 0xC0209069 occurred, and the error row disposition on "input "OLE DB Command Input" (3438)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure."
I read related posts but could not figure out the error?
i don't know how i will explain you guys, but is there any way to compair the text of two procedures/functions. the thing comes in my mind is to compair the text no any spaces or [enter]. So can any one help or idea.
I m trying to use the insert statement with in the function ! and i m getting this errror !
Server: Msg 443, Level 16, State 2, Procedure GetTotalCOst, Line 16 Invalid use of 'INSERT' within a function.
Please help me how to rectify it and how i can use the Insert statement with in the function !
Here is the code for the function.
create function dbo.GetTotalCOst(@varWork_no as numeric,@varSubWork_no as numeric)returns numeric as begin Declare @valCost integer Declare @TotService integer Declare @TotParts integer Declare @TotLabour integer Declare @TotTravel integer Declare @TotSubContract integer select @TotService= isnull(sum(quantity*costprice),0) From SB_Service_Suppply_Details where work_no=@varWork_no and subwork_no=@varSubWork_no select @TotParts= isnull(sum(quantity*costprice),0) From SB_PARTS_dETAILS where work_no=@varWork_no and subwork_no=@varSubWork_no insert into dbo.SB_InvoiceCostingService values(@TotService,@TotParts,1,1,1,1,1,1) return (@valCost) end
The following user function is returning an error "invalid object name admin.udfAlphaOnly." This worked for me in an SQL 2000 database as a user function. However, now I am trying to add this as a Scaler-valued function in SQL 2005. Could someone please help me find what is incorrect.
I have multiple sites trying to communicate with a SQL Server 2012 Express database at another remote site. At one site I am unable to connect to the remote server. If I try to use my program I get this message:
System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The token supplied to the function is invalid)
If I try to connect using SSMS I get the same error.I have been unable to find any reference to this message on the internet.
Well adding it to a group by or function skews the result set. How to write this query so it displays as I need it to? Â This is what I have thus far, and it works as it should UNTIL I add in the line ofÂ
cast(cte.[C] As float)/cast(sum(cte.[C]) over() as float)*100 As [Rate1],
Presents the error of: Msg 8120, Level 16, State 1, Line 35 Column 'cte.[C]' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
This is my full on query -- with 3 CTE's involved to get me the actual result set I am after. Â
;with cte as ( select [state], case when exists (select 1 from table2 R where R.centername = d.centername) then 1 else 0 end as [L], case when exists (select 1 from table3 C where C.centername = d.centername) then 1 else 0 end as [C] FROM maintable d ),