Reading Dates From An XML Source Adapter
Oct 30, 2007
I am using an "XML Source Adapter" in an SSIS Package to try and load an XML file into a database table. But having trouble with a date field.
The XSD defines the field as:-
<xs:element minOccurs="1" name="DateTime" type="xs: string" />
The XML looks like this:-
<DateTime>12/31/2007 10:12:14.123</DateTime>
And the database table column is defined:-
[DateTime] [datetime] NOT NULL,
So in the Data Flow I have a "Data Conversion Transformation" converting [DT_WSTR] to [DT_DBTIMESTAMP].
However, when I run the package I get:-
Error: 0xC02020C5 at Load XXX File, Data Conversion 1 [13550]: Data conversion failed while converting column "DateTime" (15100) to column "DateTimeDT" (15422). The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
So what how do I fix it?
I don't mind losing some miliseconds of precision, so I have tried configuring the error output of the Data Conversion for this field to "ignore failure" for "Truncation". But that seems to have no effect.
I'd be happy to change the XSD to:
<xs:element minOccurs="1" name="DateTime" type="xs:dateTime" />
But the "XML Data Flow Source" doesn't seem to support the dateTime data type.
Any suggestions appreciated. Thanks.
View 1 Replies
ADVERTISEMENT
Jun 22, 2006
I am currently writing a custom source adapter that extracts data from a JD Edwards OneWorld system. In the custom user interface of the source component I need to allow the user to set a query (a custom property), and then refresh a list of output columns that will be extracted based upon that query (similar to the list shown in the advanced editor).
My question is, can I apply the custom property change to the component and build my output column list without closing and restarting my custom UI form? I understand that the IDTSComponentUI interface being implemented allows for transactional editing of the component, in that the changes to the component are not applied until I have returned a result in the implemented Edit() method. However is there a way to apply changes without returning this result (and closing my UI)?
Essentially I am looking to have similar behaviour to that of the 'Refresh' button in the advanced component editor form.
Thanks
View 3 Replies
View Related
Jan 4, 2007
Hi All,
Using a data access mode of SQL Command, I have a stmt that returns one date ( e.g select max(LastChangedDate) from TblA ).
I want to store the result in a variable. How do I do this?
Cheers,
Tamim.
View 13 Replies
View Related
Apr 3, 2006
I'm having alot of trouble figuring out the proper way to log from inside my custom source adapter.
I couldn't find my useful information in MSDN, it mostly applies to logging from inside a script task.
I'd like to log my messages along with all the other SSIS package log entries, which I have going to the dts log table.
I'm assuming I should be using some functionality from Microsoft.SqlServer.Dts.RunTime, probably the LogProvider.
Can anyone advise?
View 3 Replies
View Related
Jul 3, 2007
I'm working on a new project using SSIS in SQL Server 2005 and have an issue that I need resolved.
I'm loading an XML file into SSIS using the XML Source Adapter. This maps to an OLE DB destination which reads the data into a SQL table (please see below for the table structure). In between this stage is a data conversion to convert the Unicode characters from XML into non-Unicode characters.
CREATE TABLE [dbo].[XMLTest](
[Forename] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
[Surname] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
[PostCode] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL
)
The problem I have is with blank strings in xml are being inserted into the SQL table as NULL values and not blanks (see the xml below).
<Root>
<People>
<Forename>Duncan3</Forename>
<Surname></Surname>
<PostCode>ME16 0WH</PostCode>
</People>
</Root>
Correct me if I'm wrong but a null value in xml means the node does not exist (See the xml below)?
<Root>
<People>
<Forename>Duncan3</Forename>
<PostCode>ME16 0WH</PostCode>
</People>
</Root>
Please also find the schema attached for reference.
<?xml version="1.0"?>
<xschema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xsequence>
<xs:element minOccurs="0" name="People">
<xs:complexType>
<xsequence>
<xs:element minOccurs="1" name="Forename" type="xstring" />
<xs:element minOccurs="0" name="Surname" type="xstring" />
<xs:element minOccurs="1" name="PostCode" type="xstring" />
</xsequence>
</xs:complexType>
</xs:element>
</xsequence>
</xs:complexType>
</xs:element>
</xschema>
View 5 Replies
View Related
Nov 21, 2007
I am using the "XML Source Adapter" in an SSIS package.
I notice that although you can specify the XML filename as an expression, the XSD appears to have to be a fixed file path.
This is a problem for me since the path for the XSD is different in my development than it will be in production (in production it's on drive E:, which I don't have).
I'd like to have the file location specified in the config file, but since I can't make it an expression how can I do that?
Also, since they don't have Connection Managers I can't switch DelayValidation on.
Thanks.
View 24 Replies
View Related
Apr 16, 2008
I am a business user trying to build an incremental ETL package with SSIS. I have a working prototype on SQL Server 2005 where I select the max(ID) from the last successful run and pass that value into a variable. Then, in my Data Flow step, I select an OLE DB source adapter and use this variable in a custom select statement.
Here's my challenge....the live data is actually in a Postgres DB so I have to use a Data Reader Source adapter. When I try to pass my variable to this adapter the job bombs out. Does anyone know how to dynamically update the query text inside a Data Reader source adapter using variables or otherwise?
View 3 Replies
View Related
Jun 1, 2006
Hi,
Quick question on how SSIS handles queries from Data Source in a Data Flow. I noticed that when I run a particular query from Query Analyzer it takes forever. But, when I run the same query in SSIS data source in a data flow. The query results are immediate.
The query plan is already cached in SQL.
Is this just something which I am seeing incorrect or is there some bit of optimization in there in SSIS. As per my understanding SSIS does not optimize the source query.
Thanks,
Gaurav
View 3 Replies
View Related
Feb 9, 2006
Hi
I am using Oledb Provider for Db2 from IBM. (There is another one from microsoft)
Through this provider I am constructing a oledb connection manager.
This connection manager I am Using in Oledb Source adapter.
Now when I set Data Access mode as Table or view I Am able to preview the data.
But when I use Data Access Mode as SQL Command try to preview I get this Error
TITLE: Microsoft Visual Studio
------------------------------
Error at s_NEWMAPPING10 [EMP [1]]: An OLE DB error has occurred. Error code: 0x80040E21.
------------------------------
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC0202009 (Microsoft.SqlServer.DTSPipelineWrap)
------------------------------
BUTTONS:
OK
------------------------------
I am not able to figure out how to resolve this.
View 3 Replies
View Related
Nov 16, 2015
I want to use the excel sheets located on a share point site as source, for this i downloaded the adapter from the following link URL....IĀ got the connection manager to work, but when coming to load the excel files to the destination location its not doing what is intended. For example i want the destination location my local drive for the excel files, how can i do that which destination should i use?
View 2 Replies
View Related
Mar 22, 2006
I am trying read certain attribute from a XML Source based on a particular attribute.
My XML source has the following Structure:<Database ID = "1" Source = "ABC" ></Database><Database ID = "2" Source = "ABC" ></Database><Database ID = "3" Source = "DEF" ></Database>.
I would like to fetch the list of IDs filtering upon Source = "ABC". (which should idealy give me 1,2)
I tried using the For Each Nodelist Enumerator By specifying the Enumeration type as Node and IDrect Input for the OuterXpathString as DATABASE[@Source="ABC"].
The for each loop fails giving the following error. Data is invalid. line 1 position 1.
Can anyone help me out with the same. Is there any other way around to obtain the required result?
Pranathi
View 3 Replies
View Related
Apr 9, 2008
Hi,
I have a commercial data source 3 party one for me to extract data from , i have been provided the exe and the DLL how i can use this in SSIS as a datasource please let me know.
Thanks,
View 4 Replies
View Related
Sep 19, 2006
The problem started off as:
I have a webservice written in VB.NET that simply returns a System.Data.Dataset. I want to use the dataset in SSIS.
So i decided to do this:
Save the returned dataset returned by the WS to an XML file. so it is sitting there, and looks like a fully valid XML file
<?xml version="1.0" encoding="utf-16"?>
<DataSet>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="SourceRecord" type="xs:string" minOccurs="0" />
<xs:element name="CombinedTitle" type="xs:string" minOccurs="0" />
......
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet>
<Table diffgr:id="Table1" msdata:rowOrder="0">
<Name>Member</Name>
<SourceRecord>99998</SourceRecord>
<CombinedTitle>Mr</CombinedTitle>
<CombinedFirst>Sample</CombinedFirst>
........
</Table>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
I then use the XML source connection to connect to it. It sees all of the columns correctly, but when i run and put a watch on it, or try to output the results to a .csv file, no records come through.
Any ideas on why there aren't any rows comming through?
i'm using SQL2005 with no SP1
View 10 Replies
View Related
Nov 27, 2007
Hi,
I have an Excel spreasheet - the first column is text, the second numbers, the third a mix of the two. If I point An Excel Source at this in my data flow, it will import the first two columns without problem, but not the third: all cells containing text are being imported as nulls, but those containing numbers are imported just fine.
Even if the numbers are stored as text, they are converted into numbers at import and genuine text is still discarded. It's treated as if the entire column is numeric if there's just one numeric value in it.
I can get around this by creating a .csv or .txt file from the excel file, but that will add an extra layer of admin to this process and I'm tryuing to make it as seamless as possible
View 3 Replies
View Related
Feb 9, 2012
I have a simple SSIS package -> It reads a local text file which has 10 rows of data ( id, name, telephone # ) and puts it into a table.
It uses the "SSIS Flat File source" to read and a "SQL Command" to insert into the table. I can see that it reads line by line and puts each line into one row in my table.
Now, my production data is over 5 GiG of mainframe data and it seems their data is arranged in some hierarchical form.. so the position or arrangement of data in that file is important.
I pulled the data using my package and as far as I can see , my SSIS package pulled one line at a time ( from the flat file) and pushed it into my table. For each row, I also created an identity column in my table to be able to identify the positional arrangement of the hierarchical data and then use relational mappings to suit our business needs.
In all of this, my assumption is -
"SSIS reads one line at a time, inserts to my table and goes down to the next line .
It does NOT read a snapshot of rows from the flat file so as to write them into the table using internal ordering methods based on that particular snapshot "
My question is .. is my assumption correct ?
View 1 Replies
View Related
Aug 28, 2006
Hi,
I'm using a script task as source and I need to read a global variable.
I tried stuff I found on the internet, but they all use Dts.VariableDispenser.LockForRead(varName)
This gives an errero on 'Dts.' saying it can not resolve it.
View 2 Replies
View Related
May 2, 2007
I am trying to ETL from excel source to SQL table. When I created the package my excel had certain number of rows. Later if I add (append) few more rows in the spreadsheet ... the ssis package (also in excel source preview) not reading the newly added rows. Suprisingly it is reading new rows if they are inserted in between existing rows.
Any idea why ?
View 9 Replies
View Related
Aug 3, 2005
I have a tab delimited flat file with say 60 columns. All columns can have null values. The file contains a blank tab for nulls.
View 25 Replies
View Related
Apr 26, 2008
Hi. I need to import excel file in database. i first need to do an unpivot task. the column names are dates and SSIS seems to be unable to pick up the column name as it is replaced by F2 F3 F4etc Can you advise of a solution. thanks ken
View 1 Replies
View Related
Apr 15, 2008
hi I have this asp sql statement which works fine but I want to use an spl adapter instead as I am enabling paging in details view. I am stuck in one place. How do I declare @listing as I have done in the select parameter in the asp sql statement? Where in ths sql adapter do i declare it? listing value is derived from a dropdown box when the user makes a selection.
This is the sql statement i want to declare in the adapter.<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>" SelectCommand="SELECT UserDetails.UserId, UserDetails.FirstName, UserDetails.LastName, UserDetails.City, aspnet_Membership.Email FROM UserDetails INNER JOIN
aspnet_Membership ON UserDetails.UserId = aspnet_Membership.UserId WHERE Category = @Listing">
<selectparameters>
<asp:controlparameter name="Listing" controlid="SearchListingDropDownList" propertyname="SelectedValue"/></selectparameters>
This is the adapter so far which gives me an error to declare scalable value @listing. How do i incoporate the select parameters below?
Function getTheData() As DataTable Dim DS As New DataSet()
Dim strConnect As New SqlConnection(ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString1").ConnectionString)Dim objSQLAdapter As New SqlDataAdapter("SELECT aspnet_Membership.UserId,UserDetails.FirstName + ' ' + UserDetails.LastName AS 'Customer',UserDetails.City, aspnet_Membership.Email FROM aspnet_Membership INNER JOIN UserDetails ON aspnet_Membership.UserId = UserDetails.UserId WHERE Category = @Listing", strConnect)objSQLAdapter.Fill(DS, "aspnet_Membership,UserDetails")
Return DS.Tables("aspnet_Membership,UserDetails").Copy
End Function
www.mylookmeup.co.uk
View 2 Replies
View Related
Mar 2, 2006
SQL 2005 Dev
How can I do this with Parameters? I can get a single parameter to filter for a single date (or even a combo list of the dates in DB). But I want my parameters to interact so that they specify a range. Is this possible?
View 3 Replies
View Related
Nov 16, 2007
I am running Windows XP and have SQL Server 2005 Enterprise Edition that I use for testing on my notebook. I want to install Oralce 11g on it as well and use VS 2005 as a front end programming. For me to install Oracle I need to install a loopback adapter. If I do this will it mess up SQL Server 2005 or will it not affect SQL Server 2005? Please advise
View 1 Replies
View Related
Jun 9, 2008
Can someone tell me why I an getting the following error message for my table adapter: "incorrect syntax near '?'"
The selecte statement is below.
SELECT Questions.QuestionID, Questions.QuestionNumber, Questions.QuestionText, Questions.SampleAnswer, SAFSection.SectionNumber + ' - ' + SAFSection.SectionName as [Section], SAFSubSection.SubSectionNumber + ' - ' + SAFSubSection.SubSectionName as [SubSection], SAFSubSection.SubSectionDefinition, SAFSubSection.SubSectionQuestion, SAFSubSection.SubSectionInstruction, Answers.AnswerFROM (SAFSubSection INNER JOIN (SAFSection INNER JOIN Questions ON SAFSection.[SectionID] = Questions.[QuestionSectionID]) ON SAFSubSection.[SubSectionID] = Questions.[QuestionSubSectionID]) LEFT JOIN Answers ON Questions.QuestionID = Answers.QuestionIDWHERE Answers.SystemID = ?Order BY SAFSection.SectionID, SAFSubSection.SubSectionID,Questions.QuestionID
View 2 Replies
View Related
Jul 18, 2014
Today I have got one scenario to calculate the (sum of days difference minus(-) the dates if the same date is appearing both in assgn_dtm and complet_dtm)/* Here goes the table schema and sample data */
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[temp_tbl]') AND type in (N'U'))
DROP TABLE [dbo].[temp_tbl]
GO
CREATE TABLE [dbo].[temp_tbl](
[tbl_id] [bigint] NULL,
[cs_id] [int] NOT NULL,
[USERID] [int] NOT NULL,
[code]....
View 9 Replies
View Related
Nov 12, 2007
In VS2003 I have a user defaults table that I would call in the OnLoad - No Postback section to get the user defaults and then used some of the fields from that recordset as Parameters for other recordsets that would also load in that same section and might even issue a different Sql statement based on the field. In VS2005 (VB.NET), I can no longer figure out how to accomplish this. I can use the SQLDatasource Control which seems much improved but I cannot even find the generated code which I would use as a quick way to create my own datasources in the OnLoad event. Where is this code now stored and how can I accomplish my objectives in VB.NET 2005 with the current framework or programatically create data sources as necessary as I did before?
View 3 Replies
View Related
Dec 20, 2007
Hello,
I have a table adapter which uses a Query string to get the select view and a stored procedure for its delete portion. Not all of the columns in the select statement are required for the stored procedure. When I try to do the delete, it attempts at passing in more variables than it needs and ends up resulting in an error saying it can't find a procedure that is valid. Is there any way to restrict which columns are being passed?
Thanks,
Chris
View 1 Replies
View Related
Jan 31, 2006
Hi All,
I have built a custom flat file destination adapter but it appears that the code is not working. When I debug the process I notice that the ProcessInput section is called multiple times. The first time it looks like everything is working, then it call it again and there is no inpout from the DTSInput90.
Why would it do this?
Thanks
Mike
View 4 Replies
View Related
Feb 7, 2008
I have been struggling with the Adapter Fill issue for days.
I got an eeror "Invalid object name 'Weather'." Why? How to modify it?
Thanks
Code Snippet
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using My.Name.Space;
public partial class GetStrings : System.Web.UI.Page
{
getStrings g = new getStrings();
protected void Page_Load(object sender, EventArgs e)
{
string strConnectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
SqlConnection myConnection = new SqlConnection(strConnectionString);
DataSet myDataSet = new DataSet();
try
{
myConnection.Open();
// create a new DataSet
// create the data
GenerateDataSet(myDataSet, myConnection);
}
finally
{
myConnection.Close();
// bind each to table to a grid
GridView1.DataSource = myDataSet.Tables["Weather"];
}
// databind the page
GridView1.DataBind();}
void GenerateDataSet(DataSet dset, SqlConnection conn)
{
AddTable(dset);
FillTable(dset, conn);
}
void AddTable(DataSet dset)
{
// create the table
DataTable WeatherTable = new DataTable("Weather");
DataColumn WeatherID = WeatherTable.Columns.Add("State", typeof(string));
WeatherTable.Columns.Add("Division", typeof(String));
WeatherTable.Columns.Add("TEMP", typeof(string));
WeatherTable.Columns.Add("PCPN", typeof(string));
WeatherTable.Columns.Add("UL", typeof(string));
WeatherTable.Columns.Add("LL", typeof(string));
WeatherTable.Columns.Add("PCT", typeof(string));
WeatherTable.Columns.Add("POT", typeof(string));
WeatherTable.Columns.Add("RO", typeof(string));
WeatherTable.Columns.Add("MOIST_INDEX", typeof(string));
WeatherTable.Columns.Add("CF", typeof(string));
WeatherTable.Columns.Add("MNA", typeof(string));
WeatherTable.Columns.Add("DROUGHT_INDEX", typeof(string));
WeatherTable.Columns.Add("DROUGHT", typeof(string));
// set the column properties
WeatherTable.Columns["State"].MaxLength = 50;
WeatherTable.Columns["Division"].MaxLength = 50;
WeatherTable.Columns["TEMP"].MaxLength = 50;
WeatherTable.Columns["PCPN"].MaxLength = 50;
WeatherTable.Columns["UL"].MaxLength = 50;
WeatherTable.Columns["LL"].MaxLength = 50;
WeatherTable.Columns["PCT"].MaxLength = 50;
WeatherTable.Columns["POT"].MaxLength = 50;
WeatherTable.Columns["RO"].MaxLength = 50;
WeatherTable.Columns["MOIST_INDEX"].MaxLength = 50;
WeatherTable.Columns["CF"].MaxLength = 50;
WeatherTable.Columns["MNA"].MaxLength = 50;
WeatherTable.Columns["DROUGHT_INDEX"].MaxLength = 50;
WeatherTable.Columns["DROUGHT"].MaxLength = 50;
GetDataRow(WeatherTable, g.gets());
// add the table
dset.Tables.Add(WeatherTable);
}
void FillTable(DataSet dset, SqlConnection conn)
{
// create the Command and DataAdapter
SqlDataAdapter WeatherAdapter = new SqlDataAdapter();
SqlCommand WeatherCommand = new SqlCommand("SELECT State, Division,MOIST_INDEX,DROUGHT_INDEX FROM Weather", conn);
WeatherAdapter.SelectCommand = WeatherCommand;
// fill the DataTable
WeatherAdapter.Fill(dset,2,0,"Weather");//wrong here,
//WeatherAdapter.Fill(dset.Tables["Weather"]);
}
//assuming the first dimention is collumn and the second is row
public void GetDataRow(DataTable datatable, string[][] source)
{
DataRow dr;
int rows = source.GetLength(0);
int collumns = source[0].Length;
for (int i = 0; i < rows; i++)
{
dr = datatable.NewRow();
if (source[i] != null)
{
dr.ItemArray = (object[])source[i];
datatable.Rows.Add(dr);
}
}
datatable.AcceptChanges();
}
}
View 1 Replies
View Related
May 14, 2008
I downloaded and installed the Informix Client SDK 3.0 and was able to extract data from an Informix 10 database. All of a sudden, it stopped working. The error message I received is "... error in initializing provider. (-25580) System error occurred in network function.". Has anyone encountered this error before and know of a solution?
Thanks.
View 3 Replies
View Related
Nov 26, 2007
Now, I don't know if what I want to do is possible, but here goes. In the table I want to query, there is an "approval status" column, of type Int32. There are four approval levels, 1, 2, 3 and 4. What I want to set up is a query in the table adapter that can return all entries of one or more approval levels. In "raw" sql, I would do something like: SELECT * FROM facility_table WHERE (approved IN (1,2,3));What I want to do though, is to have the list of approval codes to be a parameter that I can pass to the table adapter query, so the where clause becomes "WHERE (approved IN (@approval))", and I pass a string with the list of approval codes. But the query designer doesn't want to cooperate with me, as it insists that "@approval" should be an int32.Any suggestions?
View 1 Replies
View Related
Feb 9, 2007
I have an application (ASP.NET 2.0/SQL Server 2005) which makes heavy use of table adapters for pulling records from SQL. Under heavy load, we get a lot of SQL Server Timeout errors. We have run a trace on SQL Server and it shows that several of the SQL statements being passed into SQL Server, from the Table Adapters, have bad SQL.
For example, here is the SQL in one of the table adapters
SELECT HomeMsgID, messageName, messageHTML, messageText, populationID
FROM MyUCR_HomeMessages
WHERE (populationID IN
(SELECT populationID
FROM MyUCR_Population_CPID AS
MyUCR_Population_CPID_1
WHERE (CPID = @CPID))) AND (isVisible = 1)
AND (showDate <= @showDate) AND (removeDate >= @removeDate)
I call it with the following:
DateTime showDate = DateTime.Today;
DateTime removeDate = DateTime.Today;
myUCR_HomePageMsgsTableAdapters.MyUCR_HomeMessagesTableAdapter ta = new
myUCR_HomePageMsgsTableAdapters.MyUCR_HomeMessagesTableAdapter();
myUCR_HomePageMsgs.MyUCR_HomeMessagesDataTable dt = new
myUCR_HomePageMsgs.MyUCR_HomeMessagesDataTable();
ta.FillByCPID(dt, showDate, removeDate, CPID);
What the SQL trace shows, when it fails, is this (notice the extra single
quotes around the showDate, removeDate parameters):
E000
exec sp_executesql N'SELECT HomeMsgID, messageName, messageHTML,
messageText, populationID
FROM MyUCR_HomeMessages
WHERE (populationID IN
(SELECT populationID
FROM MyUCR_Population_CPID AS
MyUCR_Population_CPID_1
WHERE (CPID = @CPID))) AND (isVisible = 1)
AND (showDate <= @showDate) AND (removeDate >= @removeDate)',N'@showDate
datetime,@removeDate datetime,@CPID int',@showDate=''2007-02-05
00:00:00:000'',@removeDate=''2007-02-05 00:00:00:000'',@CPID=3071225
1[Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '2007'.
I recreated the SQL to use a stored procedure, and got a similar error:
E000exec dbo.spFillHomeMsgByCPID @showDate=''2007-02-05
00:00:00:000'',@removeDate=''2007-02-05 00:00:00:000'',@CPID=3008195
5[Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '2007'.
However, if I create dynamic SQL and use the following, there are no errors.
string mySql = string.Empty;
mySql = "SELECT HomeMsgID, messageName, messageHTML, messageText,
populationID FROM MyUCR_HomeMessages WHERE (populationID IN (SELECT
populationID FROM MyUCR_Population_CPID AS MyUCR_Population_CPID_1 WHERE
(CPID = " + CPID + "))) AND (isVisible = 1) AND (showDate <= '" + showDate +
"') AND (removeDate >= '" + removeDate + "')"; SqlDataAdapter adapter = new
SqlDataAdapter(mySql, ConfigurationManager.ConnectionStrings["MyUCR2007ConnectionString"].ToString());
DataSet RecordCount = new DataSet();
adapter.Fill(RecordCount);
DataTable testDT = RecordCount.Tables[0];
I am using VSTS with the Service Pack installed. SQL 2005 is running on W2K3 Enterprise, fully patchedThanks,James
View 1 Replies
View Related
Oct 22, 2007
Hi,
Will someone please tell me how to use
"Destination adapter in store procedure" .............
I'm using Sql server 2005, instead of using BCP i have to use
"Sql server destination adapter" in my store procedure,
Is it possible to implement destination adapter in store procs,
if it is yes please let me know how
Thanks and Regards
Altaf Hussain Nizamuddin
View 2 Replies
View Related
Oct 22, 2007
Hi,
Will someone please tell me how to use
"Destination adapter in store procedure" .............
I'm using Sql server 2005, instead of using BCP i have to use
"Sql server destination adapter" in my store procedure,
Is it possible to implement destination adapter in store procs,
if it is yes please let me know how
Thanks and Regards
Altaf Hussain Nizamuddin
View 4 Replies
View Related