SQL 2008 R2 Unstable query

Hello everyone,
I have a query that selects no data but if fails when there's an order by clause or if there's a conversion of hardcoded date.
The error looks like this: 
This only happens when the table is indexed.
I put a repro code below.
Could you please let me know if the error reprodces itself in your environment and your thoughts why ?
Thanks in advace.
The code below reproduces the issue:
CREATE TABLE [dbo].[Test](
[ID] [varchar](20) NOT NULL,
[DateStr] [varchar](20) NOT NULL,
[status] [varchar](6) NOT NULL,
) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Test] ON [dbo].Test
[ID] ASC
--, [coverage] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
Insert Test
ID
, DateStr
, status
Values
'policy number'
, 'paid date'
, 'status'
-- This query fails
select *
, datepart(mm,Convert(datetime, '2015-03-24 23:59:00.000', 120))
from Test
where status = 'I'
and convert(datetime,DateStr,103) < Convert(datetime, '2015-03-24 23:59:00.000', 120) --@curr_date--'2015-03-24 23:59:00.000'
order by ID
-- This query works
select *
--, datepart(mm,Convert(datetime, '2015-03-24 23:59:00.000', 120))
from Test
where status = 'I'
and convert(datetime,DateStr,103) < Convert(datetime, '2015-03-24 23:59:00.000', 120) --@curr_date--'2015-03-24 23:59:00.000'
order by ID
-- This query also works
select *
, datepart(mm,Convert(datetime, '2015-03-24 23:59:00.000', 120))
from Test
where status = 'I'
and convert(datetime,DateStr,103) < Convert(datetime, '2015-03-24 23:59:00.000', 120) --@curr_date--'2015-03-24 23:59:00.000'
--order by ID
-- If I drop the index all queries work
Drop index Test.IX_Test
Conversion failed when converting date and/or time from character string.
SSIS question

There is no guaranteed order of evaluation, so a query with a potential conversion error in it may succeed or fail depending on the query plan, phase of the moon etc. This also applies if the conversion is in the SELECT list, and the WHERE clause filters
out the bad data. I'm not sure that I like the latter part, but that is just the way it works.
The only way to filter out bad data in SQL 2008 is by using CASE:
CASE WHEN isdate(col) = 1 THEN convert(datetime, col) ELSE NULL END
This is needed both in the WHERE clause and in the SELECT list.
It can be problematic if isdate returns 0, but the string converts according to the selected format code or vice versa.
On SQL 2012 and later, because here you can use try_convert which returns NULL if the string does not convert.
A general piece of advice is that you should not store dates or numbers in varchar columns. It is bound to cause misery and grief.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Query to find First sunday of march and Second Sunday of November in SQL 2008

    Hi,
    I want query to find Second sunday of march and First Sunday of November in SQL 2008. This query can be used for Daylight savings(MST).
    Thanks in Advance.
    Regards,
    LuckyAbdul

    declare @d datetime,@d1 datetime
    set @d = '20140301'
    set @d1='20081101'
     SELECT @d1
    declare @baseMonday datetime
    set @baseMonday = '17530101'
    select
       @baseMonday + datediff(day,@baseMonday,@d)/7*7+13  as Sunday,
       @baseMonday + datediff(day,@baseMonday,@d1)/7*7+6 as Sunday1
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Error "Conversion failed when converting date and/or time from character string" to execute one query in sql 2008 r2, run ok in 2005.

    I have  a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".
    USE [Runtime]
    GO
    /****** Object:  UserDefinedFunction [dbo].[f_Pinto_Graf_P_Opt]    Script Date: 06/11/2013 08:47:47 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE   FUNCTION [dbo].[f_Pinto_Graf_P_Opt] (@fechaInicio datetime, @fechaFin datetime)  
    -- Declaramos la tabla "@Produc_Opt" que será devuelta por la funcion
    RETURNS @Produc_Opt table ( Hora datetime,NSACOS int, NSACOS_opt int)
    AS  
    BEGIN 
    -- Crea el Cursor
    DECLARE cursorHora CURSOR
    READ_ONLY
    FOR SELECT DateTime, Value FROM f_PP_Graficas ('Pinto_CON_SACOS',@fechaInicio, @fechaFin,'Pinto_PRODUCTO')
    -- Declaracion de variables locales
    DECLARE @produc_opt_hora int
    DECLARE @produc_opt_parc int
    DECLARE @nsacos int
    DECLARE @time_parc datetime
    -- Inicializamos VARIABLES
    SET @produc_opt_hora = (SELECT * FROM f_Valor (@fechaFin,'Pinto_PRODUC_OPT'))
    -- Abre y se crea el conjunto del cursor
    OPEN cursorHora
    -- Comenzamos los calculos 
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    /************  BUCLE WHILE QUE SE VA A MOVER A TRAVES DEL CURSOR  ************/
    WHILE (@@fetch_status <> -1)
    BEGIN
    IF (@@fetch_status = -2)
    BEGIN
    -- Terminamos la ejecucion 
    BREAK
    END
    -- REALIZAMOS CÁLCULOS
    SET @produc_opt_parc = (SELECT dbo.f_P_Opt_Parc (@fechaInicio,@time_parc,@produc_opt_hora))
    -- INSERTAMOS VALORES EN LA TABLA
    INSERT @Produc_Opt VALUES (@time_parc,@nsacos, @produc_opt_parc)
    -- Avanzamos el cursor
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    END
    /************  FIN DEL BUCLE QUE SE MUEVE A TRAVES DEL CURSOR  ***************/
    -- Cerramos el cursor
    CLOSE cursorHora
    -- Liberamos  los cursores
    DEALLOCATE cursorHora
    RETURN 
    END

    You can search the forums for that error message and find previous discussions - they all boil down to the same problem.  Somewhere in your query that calls this function, the code invoked implicitly converts from string to date/datetime.  In general,
    this works in any version of sql server if the runtime settings are correct for the format of the string data.  The fact that it works in one server and not in another server suggests that the query executes with different settings - and I'll assume for
    the moment that the format of the data involved in this conversion is consistent within the database/resultset and consistent between the 2 servers. 
    I suggest you read Tibor's guide to the datetime datatype (via the link to his site below) first - then go find the actual code that performs this conversion.  It may not be in the function you posted, since that function also executes other functions. 
    You also did not post the query that calls this function, so this function may not, in fact, be the source of the problem at all. 
    Tibor's site

  • SQL query is slow after upgrading from SQL 2008 to SQL 2008 R2

    Hello
    We were using SQL 2008 Standard, but after upgrading to R2, following query is much slower (takes 5 seconds instead of less than 1 second), how is this possible?
    Regards, Hennie
    SELECT
     P.BSN,
     P.Persnr,
     P.Roepnaam,
     P.Tussenvoegsels,
     P.Achternaam,
     P.Geslacht,
     COALESCE (P.Achternaam + ', ' + P.Roepnaam + ' ' + P.Tussenvoegsels, P.Achternaam + ', ' + P.Roepnaam, P.Achternaam) AS naamvolledig,
     P.Telmobiel,
     P.Telvast,
     P.Postcode,
     G.groep,
     COALESCE (RM.nieuweDag, GR.Dag) AS dag,
     COALESCE (RM.nieuweDatum, GR.datum) AS datum,
     DATEPART(ww, COALESCE (RM.nieuweDatum, GR.datum)) AS weeknummer,
     DATEPART(yyyy, COALESCE (RM.nieuweDatum, GR.datum)) AS jaar,
     CONVERT(VARCHAR(8),
      CASE WHEN GR.ID_lokaties = 3 THEN COALESCE (RM.nieuweBegintijd,
       CASE WHEN GR.Tijdspan = 2 THEN R.begintijd2 ELSE R.begintijd END)
      ELSE COALESCE (RM.nieuweBegintijd, GR.begintijd) END, 108) AS begintijdberekend,
     CONVERT(VARCHAR(8),
      CASE WHEN GR.ID_lokaties = 3 THEN COALESCE (RM.nieuweEindtijd,
       CASE WHEN GR.Tijdspan = 2 THEN R.eindtijd2 ELSE R.eindtijd END)
      ELSE COALESCE (RM.nieuweEindtijd, GR.eindtijd) END, 108) AS eindtijdberekend,
     CASE WHEN GR.ID_lokaties = 3 THEN
       CONVERT(NCHAR(5), COALESCE (RM.nieuweBegintijd,CASE WHEN GR.Tijdspan = 2 THEN R.begintijd2 ELSE R.begintijd END), 108) + '-' +
       CONVERT(NCHAR(5), COALESCE (RM.nieuweEindtijd, CASE WHEN GR.Tijdspan = 2 THEN R.eindtijd2 ELSE R.eindtijd END), 108)
      ELSE CONVERT(NCHAR(5),COALESCE (RM.nieuweBegintijd, GR.begintijd), 108) + '-' + CONVERT(NCHAR(5), COALESCE (RM.nieuweEindtijd, GR.eindtijd), 108)
      END AS Tijdspanne,
     CASE
      WHEN GR.ID_lokaties = 3 AND R.id_relaties = 9 THEN 'Werk Intern'
      WHEN GR.ID_lokaties = 3 THEN R.relatienaam
      ELSE L.lokatie END AS Lokatieberekend,
     R.relatienaam AS relatie,
     L.IntExt,
     RA.Omschrijving AS roosteractiviteit,
     A.instroomdatum,
     A.uitstroomdatum,
     TT.trajecttype,
     W.Naamvolledig AS Werkcoach,
     A.ID_groepen,
     T.ID_personen,
     A.ID_werkcoaches,
     CASE
      WHEN GR.ID_lokaties = 3 AND R.id_relaties = 9 THEN 20
      WHEN GR.ID_lokaties = 3 THEN R.id_relaties
      ELSE L.ID_relaties END AS ID_lokatieberekend,
     A.ID_relaties AS ID_relatie,
     R.nummer2 AS capaciteit,
     GR.ID_groepsroosters,
     CAST(CASE WHEN foto IS NOT NULL THEN 'Ja' ELSE NULL END AS char(2)) AS Foto,
     W.Email,
     W.TelefoonMobiel,
     W.TelefoonVast
    FROM
     dbo.personen AS P INNER JOIN
     dbo.trajecten AS T ON T.ID_personen = P.ID_personen INNER JOIN
     dbo.trajecttype AS TT ON T.ID_trajecttype = TT.ID_trajecttype INNER JOIN
     dbo.trajectactiviteiten AS A ON A.ID_trajecten = T.ID_trajecten INNER JOIN
     dbo.groepsroosters AS GR ON GR.ID_groepen = A.ID_groepen LEFT OUTER JOIN
     dbo.roosteractiviteit AS RA ON GR.ID_roosteractiviteit = RA.ID_roosteractiviteit INNER JOIN
     dbo.lokaties AS L ON GR.ID_lokaties = L.ID_lokaties INNER JOIN
     dbo.werkcoaches AS W ON A.ID_werkcoaches = W.ID_werkcoaches INNER JOIN
     dbo.groepen AS G ON A.ID_groepen = G.ID_groepen LEFT OUTER JOIN
     dbo.relaties AS R ON A.ID_relaties = R.ID_relaties LEFT OUTER JOIN
     dbo.roostermutaties AS RM ON P.ID_personen = RM.ID_personen AND GR.ID_groepsroosters = RM.ID_groepsroosters AND RM.aanwezig IS NULL
    WHERE
     (COALESCE (RM.nieuweDatum, GR.datum) BETWEEN GETDATE() - 1 AND GETDATE() + 13)
     AND (COALESCE (DATEDIFF(day, COALESCE (RM.nieuweDatum, GR.datum), A.uitstroomdatum), 0) >= 0)
     AND (DATEDIFF(day, A.instroomdatum, COALESCE (RM.nieuweDatum, GR.datum)) >= 0)
     AND ((SELECT COUNT(*) AS Expr1
      FROM dbo.roostermutaties AS RM2
      WHERE (P.ID_personen = ID_personen)
      AND (GR.ID_groepsroosters = ID_groepsroosters)
      AND (CONVERT(VARCHAR(8), begintijdafwezig, 108) = CONVERT(VARCHAR(8),
      CASE WHEN GR.ID_lokaties = 3 THEN COALESCE (RM.nieuweBegintijd,
      CASE WHEN GR.Tijdspan = 2 THEN R.begintijd2 ELSE R.begintijd END)
      ELSE COALESCE (RM.nieuweBegintijd, GR.begintijd) END, 108)) AND
      (CONVERT(VARCHAR(8), eindtijdafwezig, 108) = CONVERT(VARCHAR(8), CASE WHEN GR.ID_lokaties = 3 THEN COALESCE (RM.nieuweEindtijd,
      CASE WHEN GR.Tijdspan = 2 THEN R.eindtijd2 ELSE R.eindtijd END) ELSE COALESCE (RM.nieuweEindtijd, GR.eindtijd) END, 108))) = 0)

    We were using SQL 2008 Standard, but after upgrading to R2, following query is much slower (takes 5 seconds instead of less than 1 second), how is this possible?
    It is not uncommon to experience performance problems following an upgrade when there are issues with original query.  Non-sargable expressions like Olaf called out are often the culprit, as well as lack of useful indexes and statistics. 
    The optimizer cannot glean accurate row count estimates or use indexes efficiently so the resultant plan may not be optimal for the task at hand.  It is only by happenstance that old plan performed better; it could just as well be the other way around,
    but again only by chance since the optimizer is guessing.
    You might also try using EXISTS instead of SELECT COUNT(*)...= 0:
    AND EXISTS(SELECT *
    FROM dbo.roostermutaties AS RM2
    WHERE P.ID_personen = ID_personen
    AND GR.ID_groepsroosters = ID_groepsroosters
    AND CONVERT(VARCHAR(8), begintijdafwezig, 108) = CONVERT(VARCHAR(8),
    CASE WHEN GR.ID_lokaties = 3 THEN COALESCE (RM.nieuweBegintijd,
    CASE WHEN GR.Tijdspan = 2 THEN R.begintijd2 ELSE R.begintijd END)
    ELSE COALESCE (RM.nieuweBegintijd, GR.begintijd) END, 108)
    AND CONVERT(VARCHAR(8), eindtijdafwezig, 108) = CONVERT(VARCHAR(8), CASE WHEN GR.ID_lokaties = 3 THEN COALESCE (RM.nieuweEindtijd,
    CASE WHEN GR.Tijdspan = 2 THEN R.eindtijd2 ELSE R.eindtijd END) ELSE COALESCE (RM.nieuweEindtijd, GR.eindtijd) END, 108))
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Dg4odbc, unixODBC, freeTDS - connection problems to MS SQL 2008

    I am trying to set up a database link between my 64bit Oracle 11g running on CentOS 6.2 and my MS SQL 2008 server running on MS Windows server 2003. I have installed the following -
    freeTDS - version 0.91 (64 bit)
    unixODBC - version 2.3.1 (64 bit)
    I have successfully configured ODBC and freeTDS so that I can connect using isql and query my MSSQL database. The problem I am having is connecting Oracle to MSSQL, I am sure it is a simple configuration error but I have been going round in circles with this and hope someone can help!
    freetds.conf
    [global]
    timeout = 10
    connect timeout = 10
    text size = 64512
    [CERM]
    host = 192.168.xxx.xxx
    port = 1101
    tds version = 7.2
    instance = SSLSQLDB
    dump file = /tmp/dump.log
    odbc.ini
    [ODBC Data Sources]
    CERM=TDS connection
    [CERM]
    Servername = CERM
    Description = TDS connection
    Driver = /usr/local/lib/libtdsodbc.so
    UsageCount = 1
    FileUsage = 1
    [ODBC]
    Trace=255
    odbcinst.ini
    [TDS]
    Description = FreeTDS driver for MS SQL
    Driver = /usr/local/lib/libtdsodbc.so
    Setup = /usr/lib64/libtdsS.so
    Trace = Yes
    TraceFile = /tmp/freetd.log
    FileUsage = 1
    [FreeTDS]
    Description = FreeTDS driver for MS SQL
    Driver = /usr/local/lib/libtdsodbc.so
    Setup = /usr/lib64/libtdsS.so
    Trace = Yes
    TraceFile = /tmp/freetd.log
    FileUsage = 1
    (Because I have put the actual path to the driver in the odbc.ini file I don;t believe the odbcinst.ini file is actually used)
    inithscerm.ora
    # This is a sample agent init file containing the HS parameters that
    # are needed for an ODBC Agent.
    # HS init parameters
    HS_FDS_CONNECT_INFO=CERM
    HS_FDS_TRACE_LEVEL=255
    #HS_FDS_TRACE_FILE_NAME = /tmp/hsodbcsql.trc
    HS_FDS_SHAREABLE_NAME=/usr/local/lib/libodbc.so
    HS_FDS_SUPPORT_STATISTICS=FALSE
    set ODBCINI=/usr/local/etc/odbc.ini
    (my odbc.ini file is located in /usr/local/etc)
    listener.ora
    # listener.ora Network Configuration File: /usr/oracle/product/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = ssl-oracle.domain)(PORT = 1521))
    ADR_BASE_LISTENER = /usr/oracle
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC=
    (SID_NAME=hscerm)
    (ORACLE_HOME=/usr/oracle/product)
    (PROGRAM=dg4odbc)
    (ENVS=LD_LIBRARY_PATH = /usr/local/lib:$ORACLE_HOME/lib)
    (SID_DESC=
    (SID_NAME=PROD)
    (ORACLE_HOME=/usr/oracle/product)
    tnsnames.ora
    # tnsnames.ora Network Configuration File: /usr/oracle/product/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.
    PROD =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ssl-oracle.domain)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = PROD.DOMAIN)
    hscerm=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=TCP)(HOST=ssl-oracle.domain)(PORT=1521))
    (CONNECT_DATA= (SID=hscerm))
    (HS=OK)
    right - I can tnsping my hscerm instance and that returns ok so I'm fairly sure the configuration is fine for both tnsnames.ora and listener.ora. I can isql connect to the ODBC defined name for the the MSSQL database. but when I create a database link in Oracle and then test it I get the following trace output :-
    [ODBC][14030][1339512618.356535][SQLSetConnectAttrW.c][332]
    Entry:
    Connection = 0x2054640
    Attribute = SQL_ATTR_AUTOCOMMIT
    Value = (nil)
    StrLen = -5
    [ODBC][14030][1339512618.356616][SQLSetConnectAttrW.c][616]
    Exit:[SQL_SUCCESS]
    [ODBC][14030][1339512618.356984][SQLDriverConnectW.c][290]
    Entry:
    Connection = 0x2054640
    Window Hdl = (nil)
    Str In = [DNCR;I=APDagj20][length = 30]
    Str Out = 0x2053408
    Str Out Max = 1024
    Str Out Ptr = 0x7fff6d305770
    Completion = 0
    [ODBC][14030][1339512618.357030][SQLDriverConnectW.c][500]Error: IM002
    [ODBC][14030][1339512618.357115][SQLGetDiagRecW.c][508]
    Entry:
    Connection = 0x2054640
    Rec Number = 1
    SQLState = 0x7fff6d3053d0
    Native = 0x7fff6d3051c4
    Message Text = 0x7fff6d3051d0
    Buffer Length = 510
    Text Len Ptr = 0x7fff6d305420
    [ODBC][14030][1339512618.357153][SQLGetDiagRecW.c][550]
    Exit:[SQL_SUCCESS]
    SQLState = IM002
    Native = 0x7fff6d3051c4 -> 0
    Message Text = [[unixODBC][Driver Manager]Data source name not found, and no default driver specified]
    [ODBC][14030][1339512618.357197][SQLGetDiagRecW.c][508]
    Entry:
    Connection = 0x2054640
    Rec Number = 2
    SQLState = 0x7fff6d3053d0
    Native = 0x7fff6d3051c4
    Message Text = 0x7fff6d3051d0
    Buffer Length = 510
    Text Len Ptr = 0x7fff6d305420
    [ODBC][14030][1339512618.357228][SQLGetDiagRecW.c][550]
    Exit:[SQL_NO_DATA]
    [ODBC][14030][1339512618.357291][SQLDisconnect.c][208]
    Entry:
    Connection = 0x2054640
    [ODBC][14030][1339512618.357321][SQLDisconnect.c][237]Error: 08003
    [ODBC][14030][1339512618.357387][SQLFreeHandle.c][284]
    Entry:
    Handle Type = 2
    Input Handle = 0x2054640
    Now I can clearly see the error "Data source name not found, and no default driver specified" which according to all the documentation means that the entry HS_FDS_CONNECT_INFO=CERM does not match the entry in my odbc.ini file ([CERM]) but for the life of me I can;t see why they don;t match ??
    Any help greatly received.

    Yeah I verified with isql but I have changed the odbc.ini file as you suggested -
    [root@ssl-oracle ~]# more /usr/local/etc/odbc.ini
    [ODBC Data Sources]
    CERM=TDS connection
    [CERM]
    Server = 192.168.xxx.xxx
    Driver = /usr/local/lib/libtdsodbc.so
    Database = sqlb00
    Port = 1101
    TDS_Version = 8.0
    QuotedId = YES
    [ODBC]
    Trace=255
    [root@ssl-oracle admin]# more inithscerm.ora
    # This is a sample agent init file containing the HS parameters that
    # are needed for an ODBC Agent.
    # HS init parameters
    HS_FDS_CONNECT_INFO=CERM
    HS_FDS_TRACE_LEVEL=255
    #HS_FDS_TRACE_FILE_NAME = /tmp/hsodbcsql.trc
    HS_FDS_SHAREABLE_NAME=/usr/local/lib/libodbc.so
    HS_FDS_SUPPORT_STATISTICS=FALSE
    HS_LANGUAGE=american_america.we8mswin1252
    HS_NLS_NCHAR=UCS2
    set ODBCINI=/usr/local/etc/odbc.ini
    [root@ssl-oracle admin]# osql -S CERM -U sa -P supersecretpassword
    checking shared odbc libraries linked to isql for default directories...
    trying /tmp/sql ... no
    trying /tmp/sql ... no
    trying /usr/loc ... no
    trying /tmp/sql.log ... no
    trying /home ... no
    trying /.odbc.ini ... no
    trying /usr/local/etc ... OK
    checking odbc.ini files
    cannot read "/root/.odbc.ini"
    reading /usr/local/etc/odbc.ini
    [CERM] found in /usr/local/etc/odbc.ini
    found this section:
    [CERM]
    Server = 192.168.xxx.xxx
    Driver = /usr/local/lib/libtdsodbc.so
    Database = sqlb00
    Port = 1101
    TDS_Version = 8.0
    QuotedId = YES
    looking for driver for DSN [CERM] in /usr/local/etc/odbc.ini
    found driver line: " Driver = /usr/local/lib/libtdsodbc.so"
    driver "/usr/local/lib/libtdsodbc.so" found for [CERM] in odbc.ini
    found driver named "/usr/local/lib/libtdsodbc.so"
    /usr/local/lib/libtdsodbc.so is an executable file
    "Server" found, not using freetds.conf
    Server is "192.168.xxx.xxx"
    looking up hostname for ip address 192.168.xxx.xxx
    Configuration looks OK. Connection details:
    DSN: CERM
    odbc.ini: /usr/local/etc/odbc.ini
    Driver: /usr/local/lib/libtdsodbc.so
    Server hostname: ssl-database.domain
    Address: 192.168.xxx.xxx
    Attempting connection as sa ...
    + isql CERM sa supersecretpassword -v
    | Connected! |
    | |
    | sql-statement |
    | help [tablename] |
    | quit |
    | |
    SQL>
    sql.log
    [ODBC][31473][1339581606.488571][SQLSetConnectAttr.c][396]
    Entry:
    Connection = 0x26c2a30
    Attribute = SQL_ATTR_AUTOCOMMIT
    Value = (nil)
    StrLen = -5
    [ODBC][31473][1339581606.488638][SQLSetConnectAttr.c][681]
    Exit:[SQL_SUCCESS]
    [ODBC][31473][1339581606.488924][SQLDriverConnect.c][726]
    Entry:
    Connection = 0x26c2a30
    Window Hdl = (nil)
    Str In = [DSN=CERM;UID=SA;PWD=**********][length = 30]
    Str Out = 0x26c4b18
    Str Out Max = 1024
    Str Out Ptr = 0x7fff12846560
    Completion = 0
    UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'
    DIAG [01000] [FreeTDS][SQL Server]Unknown host machine name.
    DIAG [08001] [FreeTDS][SQL Server]Unable to connect to data source
    [ODBC][31473][1339581606.491276][SQLDriverConnect.c][1353]
    Exit:[SQL_ERROR]
    [ODBC][31473][1339581606.491358][SQLGetDiagRec.c][680]
    Entry:
    Connection = 0x26c2a30
    Rec Number = 1
    SQLState = 0x7fff128461c0
    Native = 0x7fff12845fb4
    Message Text = 0x7fff12845fc0
    Buffer Length = 510
    Text Len Ptr = 0x7fff12846210
    [ODBC][31473][1339581606.491395][SQLGetDiagRec.c][717]
    Exit:[SQL_SUCCESS]
    SQLState = 08001
    Native = 0x7fff12845fb4 -> 0
    Message Text = [[unixODBC][FreeTDS][SQL Server]Unable to connect to data source]
    [ODBC][31473][1339581606.491442][SQLGetDiagRec.c][680]
    Entry:
    Connection = 0x26c2a30
    Rec Number = 2
    SQLState = 0x7fff128461c0
    Native = 0x7fff12845fb4
    Message Text = 0x7fff12845fc0
    Buffer Length = 510
    Text Len Ptr = 0x7fff12846210
    [ODBC][31473][1339581606.491493][SQLGetDiagRec.c][717]
    Exit:[SQL_SUCCESS]
    SQLState = 01000
    Native = 0x7fff12845fb4 -> 20013
    Message Text = [[unixODBC][FreeTDS][SQL Server]Unknown host machine name.]
    [ODBC][31473][1339581606.491528][SQLGetDiagRec.c][680]
    Entry:
    Connection = 0x26c2a30
    Rec Number = 3
    SQLState = 0x7fff128461c0
    Native = 0x7fff12845fb4
    Message Text = 0x7fff12845fc0
    Buffer Length = 510
    Text Len Ptr = 0x7fff12846210
    [ODBC][31473][1339581606.491558][SQLGetDiagRec.c][717]
    Exit:[SQL_NO_DATA]
    [ODBC][31473][1339581606.491623][SQLDisconnect.c][208]
    Entry:
    Connection = 0x26c2a30
    [ODBC][31473][1339581606.491652][SQLDisconnect.c][237]Error: 08003
    [ODBC][31473][1339581606.491719][SQLFreeHandle.c][284]
    Entry:
    Handle Type = 2
    Input Handle = 0x26c2a30
    [ODBC][31473][1339581606.491750][SQLFreeHandle.c][333]
    Exit:[SQL_SUCCESS]
    [ODBC][31473][1339581606.493083][SQLFreeHandle.c][219]
    Entry:
    Handle Type = 1
    Input Handle = 0x26abfe0
    I can also ping both the hostname and ip address of the MSSQL server.

  • ColdFusion 9 Fails after SQL 2008 Cluster Failover

    All,
    I have a ColdFusion 9 app server that seems to be failing when my SQL 2008 cluster fails over to the passive node. By failing, my IIS server does not respond to any .cfm requests about 4-5 minutes after the failover. It serves out static and .asp pages just fine. Restarting ColdFusion server service and rebooting the server itself does not fix the problem. The only fix is to fail the SQL cluster back to the original node.
    Specs are as follows:
    SQL - SQL 2008 SP1 64-bit active/passive cluster VM
    CF - CF9 running on Windows 2008 SP2 64-bit VM
    Erick

    Problem solved. We had a linked server defined in SQL that pointed to an Oracle instance. We could successfully run the "Test Connection" in SQL Management Studio for the linked server when our SQL 2008 cluster was on node 1. However, we got an "OraOLEDBpus10.dll:  The specified module could not be found" error message when trying to test the connection when the cluster was on node 2. The fix was to add the Oracle folder path to the Windows PATH environment variable on node 2. The Oracle installer is supposed to do this automatically, so we don't know why it was missing.
    The reason CF would become unresponsive was that we had a template with a query that used the linked server. The purpose of this template was to monitor the status of the linked server. Using CF Server Monitor, we were able to see active requests to that template which would keep running and not terminate even though we set a timeout value in CF Admin.
    Erick

  • Slow Speed While fetching data from SQL 2008 using DoQuery.

    Hello,
    I am working for an AddOn and tried to use DoQuery for fetching data from SQL 2008 in C#.
    There are around 148 records which full fill this query condition but it takes much time to fetch the data.
    I wanna know that is there any problem in this code by which my application is getting slower.
    I used break Points and checked it, I founds that while connecting to the server it is taking time.
    Code:
    // Get an initialized SBObob object
    oSBObob = (SAPbobsCOM.SBObob)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge);
    //// Get an initialized Recordset object
    oRecordset = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
    string sqlstring = "select DocEntry,ItemCode From OWOR  where OWOR.Status='R' and DocEntry not in ( Select distinct(BaseRef) from IGE1 where IGE1.BaseRef = OWOR.DocEntry)";
    oRecordset.DoQuery(sqlstring);
    var ProductList = new BindingList<KeyValuePair<string, string>>();
    ProductList.Add(new KeyValuePair<string, string>("", "---Please Select---"));
    while (!(oRecordset.EoF))
    ProductList.Add(new KeyValuePair<string, string>(oRecordset.Fields.Item(0).Value.ToString(), oRecordset.Fields.Item(0).Value.ToString() + " ( " + oRecordset.Fields.Item(1).Value.ToString() + " ) "));
    oRecordset.MoveNext();
    cmbProductionOrder.ValueMember = "Key";
    cmbProductionOrder.DisplayMember = "Value";
    Thanks and Regards,
    Ravi Sharma

    Hi Ravi,
    your code and query look correct. But can you ellaborate a little bit.
    It seems to be a DI API program ( no UI API ) ?
    When you say "I founds that while connecting to the server it is taking time." do you mean the recordset query or the DI API connection to SBO ? The later would be "normal" since the connection can take up to 30 seconds.
    To get data it is usually better to use direct SQL connections.
    regards,
    Maik

  • Oracle 10G 64bit to SQL 2008 64bit is very slow

    I am running SQL 2008 64bit on a Windows 2008 64bit server. I installed the Oracle 10.2.0.4 w2k8 / vista 64 bit client and selected the "Admin" option. I also installed Oracle SQL Developer on the MSSQL box. I am noticing significant performance issues with the Oracle linked server from within MSSQL. In MSSQL I am using the Oracle Provider for OLE DB (OraOLEDB.Oracle) and the Data Source is pulling from TNSNames. I setup SQL Developer connections as "Basic". When I run this query (SELECT DISTINCT <column> FROM <table>) from Oracle SQL Developer the data returns in just over 1 seconds (1.007). When I run the same query in MSSQL as "SELECT DISTINCT <column> FROM <linked server>..<Schema>.<table>) from MSSQL it takes 26 seconds to get the data back. I have the "Allow inprocess" option enabled.
    Does anyone know how to fix this problem?

    I did find that the <server>..<schema>.<table> syntax does not always perform remote execution. To force MSSQL to run remote execution you have to use their OPENQUERY procedure. This requires embedding PL/SQL within the T-SQL code so that everything passes from Microsoft to Oracle. It also complicates even the simplest queries.

  • SQL Server Management 6.5.1.0 and 6.5.4.0 does not discovery SQL 2008 databases on Windows 2003

    SQL Server Management 6.5.1.0 and 6.5.4.0 does not discovery SQL 2008 databases on a custom instance name or when multiple SQL instances are installed on Windows 2003.
    OS Version: Windows 2203 x64 with SP2
    Database Version: 10.3.5869.0
    The instance in this case: I01 is running on port 49168.
    SQL Server Network Configuration | Protocols for I01 | IP Addresses | IPAll | TCP Port = 49168
    The DB Engine class is discovered but not the "Tcp Port" property.
    The database discovery script then fails as it is missing the 8th parameter; The Port.
    Looking at the discovery script DiscoverSQL2008DBEngineDiscovery.vbs i see the following WMI query.
    Set oWMI = GetObject("winmgmts:\\" & computerName & "\root\Microsoft\SqlServer\" & SQL_WMI_NAMESPACE)  
    Set oQuery = oWMI.ExecQuery("SELECT * FROM ServerNetworkProtocolProperty
    Using WMI Explorer if I connect to namespace: root\Microsoft\SqlServer\ComputerManagement10
    and query "SELECT * FROM ServerNetworkProtocolProperty". There are no instances.
    What am I missing or doing wrong?
    Closely related to this article. https://gallery.technet.microsoft.com/Hotfix-Management-Pack-SQL-17cf1118#content.
    Thanks
    Gavin

    Hi,
    I would like to know is there any update about the issue. If the issue is solved, will you please share the resolution here to help others in this forum who encounter similar issue.
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Sql:variable and XML query performance

    Can someone help with sql:variable() in xml queries?  It seems that when I attempt to reference variables with the sql:variable(...) function in an xpath function (exist or nodes) it comes up with a totally different query plan, possibly ignoring
    my secondary indices like the ones for VALUE, PATH.
    But if I replace sql:variable("@p_ObjectIdentifierForReference") with the literal (ie. "ord/p/ord0616.p") then it uses secondary indices more consistently.
    Below you will see an unsuccessful attempt to get the query to "OPTIMIZE FOR" a specific literal value of @p_ObjectIdentifierForReference.  But this doesn't give work.  It doesn't give me a plan using the secondary index I expect.
    Ideally there would be a way to get the sql:variable(...) function to give the same query plan as a literal. Not sure why that isn't the default behavior.
    DECLARE
    @p_ObjectIdentifierForReference
    varchar(500);
    SET
    @p_ObjectIdentifierForReference
    = 'ord/p/ord0616.p';
    WITH
    XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004'
    as D)
    SELECT  
    XREF_FileDataReference.XREF_FileData     
    AS XrefFileData,
    InnerRowNode.value('/D:Reference[1]/D:File-num[1]',
    'int') 
    AS FileNumber,
    InnerRowNode.value('/D:Reference[1]/D:Line-num[1]',
    'int') 
    AS LineNumber
    FROM
    (SELECT
    XREF.XREF_FileData.XREF_FileData,
    XREF.XREF_FileData.XREF_FileEntry,
    InnerRow.query('.')
    AS InnerRowNode
     FROM
    XREF.XREF_FileData
    OUTER APPLY
    DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference")
    and @Reference-type = "RUN"]')
    as T(InnerRow)                                                           
    WHERE    DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier
    = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]')
    = 1) 
    AS XREF_FileDataReference
     INNER
    JOIN  XREF.XREF_MemberBuilt  
    ON XREF_MemberBuilt.XREF_FileData  
    = XREF_FileDataReference.XREF_FileData
     INNER
    JOIN  XREF.XREF_FileEntry 
    ON XREF_FileEntry.XREF_FileEntry
    = XREF_FileDataReference.XREF_FileEntry 
    WHERE
    XREF_MemberBuilt.XREF_ProjectBuilt
    = 69
    OPTION(RECOMPILE,
    OPTIMIZE FOR (@p_ObjectIdentifierForReference
    = 'ord/p/ord0616.p')

    I tried to create a "repro" of your query so we can work on it and try and improve it, but I got the best results by just adding text() and [1] to it, eg
    SELECT
    XREF_FileDataReference.XREF_FileData AS XrefFileData,
    InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
    InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
    FROM (
    In my main repro, even with a large piece of xml with 100,000 elements, there still wasn't much difference between the queries:
    USE tempdb
    GO
    IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = 'XREF' )
    EXEC( 'CREATE SCHEMA XREF' )
    GO
    IF OBJECT_ID('XREF.XREF_FileData') IS NOT NULL DROP TABLE XREF.XREF_FileData
    CREATE TABLE XREF.XREF_FileData
    rowId INT IDENTITY,
    DataXref XML,
    XREF_FileData INT,
    XREF_FileEntry INT,
    CONSTRAINT PK_XREF_FileData PRIMARY KEY ( rowId )
    GO
    IF OBJECT_ID('XREF.XREF_MemberBuilt') IS NOT NULL DROP TABLE XREF.XREF_MemberBuilt
    CREATE TABLE XREF.XREF_MemberBuilt
    XREF_ProjectBuilt INT,
    XREF_FileData INT
    GO
    IF OBJECT_ID('XREF.XREF_FileEntry') IS NOT NULL DROP TABLE XREF.XREF_FileEntry
    CREATE TABLE XREF.XREF_FileEntry
    XREF_FileEntry INT
    GO
    -- Create larger piece of xml for repro
    ;WITH XMLNAMESPACES ( DEFAULT 'uri:schemas-progress-com:XREFD:0004' ), cte AS (
    SELECT TOP 100000 ROW_NUMBER() OVER ( ORDER BY ( SELECT 1 ) ) rn
    FROM master.sys.columns c1
    CROSS JOIN master.sys.columns c2
    CROSS JOIN master.sys.columns c3
    INSERT INTO XREF.XREF_FileData ( DataXref, XREF_FileData, XREF_FileEntry )
    SELECT
    SELECT
    CASE rn WHEN 9999 THEN 'ord/p/ord0616.p' ELSE CAST( rn AS VARCHAR(20) ) END AS "@Object-identifier",
    'RUN' AS "@Reference-type",
    SELECT
    rn AS "File-num",
    rn * 10 AS "Line-num"
    FOR XML PATH(''), TYPE
    ) AS "*"
    FROM cte
    FOR XML PATH('Reference'), ROOT('Source'), TYPE
    ).query('<Cross-reference xmlns="uri:schemas-progress-com:XREFD:0004">{.}</Cross-reference>'), 1, 100
    INSERT INTO XREF.XREF_FileEntry ( XREF_FileEntry )
    VALUES ( 100 )
    INSERT INTO XREF.XREF_MemberBuilt ( XREF_ProjectBuilt, XREF_FileData )
    VALUES ( 69, 1 )
    GO
    --SELECT * FROM XREF.XREF_FileData
    --SELECT * FROM XREF.XREF_FileEntry
    --SELECT * FROM XREF.XREF_MemberBuilt
    --GO
    -- Add primary XML index
    CREATE PRIMARY XML INDEX xidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    GO
    -- Add value, property and path xml indexes
    CREATE XML INDEX xvalidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    USING XML INDEX xidx_XREF_FileData FOR VALUE
    CREATE XML INDEX xpthidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    USING XML INDEX xidx_XREF_FileData FOR PATH
    CREATE XML INDEX xprpidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    USING XML INDEX xidx_XREF_FileData FOR PROPERTY
    GO
    :exit
    DBCC DROPCLEANBUFFERS
    DBCC FREEPROCCACHE
    GO
    DECLARE @p_ObjectIdentifierForReference varchar(500);
    SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
    ;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
    SELECT
    XREF_FileDataReference.XREF_FileData AS XrefFileData,
    InnerRowNode.value('/D:Reference[1]/D:File-num[1]', 'int') AS FileNumber,
    InnerRowNode.value('/D:Reference[1]/D:Line-num[1]', 'int') AS LineNumber
    FROM (
    SELECT
    XREF.XREF_FileData.XREF_FileData,
    XREF.XREF_FileData.XREF_FileEntry,
    InnerRow.query('.') AS InnerRowNode
    FROM XREF.XREF_FileData
    OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
    WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
    ) AS XREF_FileDataReference
    INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
    INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
    WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
    OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
    GO
    DBCC DROPCLEANBUFFERS
    DBCC FREEPROCCACHE
    GO
    DECLARE @p_ObjectIdentifierForReference varchar(500);
    SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
    ;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
    SELECT
    XREF_FileDataReference.XREF_FileData AS XrefFileData,
    InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
    InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
    FROM (
    SELECT
    XREF.XREF_FileData.XREF_FileData,
    XREF.XREF_FileData.XREF_FileEntry,
    InnerRow.query('.') AS InnerRowNode
    FROM XREF.XREF_FileData
    OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
    WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
    ) AS XREF_FileDataReference
    INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
    INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
    WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
    OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
    GO
    So I guess I'm saying I cannot reproduce your problem on SQL 2008 R2 or SQL 2012.  Does anything about this repro stand out as different from your situation?
    Looking at your query I would say you might consider the following:
    are you really seeing big differences in query duration?
    pretty much ignore estimated plan costs for xml queries
    consider breaking it up; eg carve off the xml then do the joins?  If poor cardinality estimation is part of the problem this might help
    Understand what PATH, PROPERTY and VALUE are for, then only create the ones you need
    do you really have the range of queries that requires all three?
    this is still a great article on xml indexes:
    http://technet.microsoft.com/en-us/library/ms191497.aspx
    What's performance like with the primary xml index only?
    If performance is that important, consider materialising the columns permanently
    I think the buffer_descriptors stuff is a distraction - mostly your cache is warm right?
    plan forcing could be a last resort
    Selective XML indexes in SQL 2012 onwards are great : )  much less storage required for example but much more specific

  • SQL Exoress 2008 import export Wizard wont import Access 2003 mdb to SQL 2008 DB

    Just installed SQL Express with Tools, including SSME and Import Export Wizard.
    Attempted to transfer Access 2003 DB tables from an mdb file to a SQL 2008 Express DB.
    I can view the data in the tables in Access, however, when I tell it to  do the deed, it begins the process and then errors out with a Error 0xc020801c:
    "TITLE: SQL Server Import and Export Wizard
    Could not connect source component.
    Error 0xc020801c: Source - ParentingStats [1]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
    ADDITIONAL INFORMATION:
    Exception from HRESULT: 0xC020801C (Microsoft.SqlServer.DTSPipelineWrap)"
    I am unable to find anything that translates this into something mere mortals can deal with.  This is repeatable.
    Steps in the wizard:
    1.  Source: Data Source selected is "Microsoft Access".  The filename is correct.  The username is correct.  The password is blank (there is no password in the Access db).  Clicking on the "Advanced..." button, I get the opportunity to "Test Connection".  I test the connection and the test is successful.
    2.  Destination: I select my server name and the SQL Native Client, select Windows Authentication, and Select my SQL 2008 Express db from the dropdown list.
    3.  Specify Tabloe Copy or Query: I select Table copy
    4.  Select Table or Views: I check the tables I want to copy and successfully preview the data in each table that I checked.  I click on "Edit Mappings ..." and verify that I want to create a new table for each checked table.
    5.  Run package: I accept the pre-checked "Run Immediately" and click the NEXT button
    6.  I get the following:
    "Source Location : C:\Users\wb5rvz\Documents\StatisticsApp_V3_69.mdb
    Source Provider : Microsoft.Jet.OLEDB.4.0
    Destination Location : SHACK_PC\SQLEXPRESS
    Destination Provider : SQLNCLI
    Copy rows from `ParentingStats` to [dbo].[ParentingStats]
    The new target table will be created.
    Copy rows from `Statistics` to [dbo].[Statistics]
    The new target table will be created.
    Copy rows from `StatsSummary` to [dbo].[StatsSummary]
    The new target table will be created.
    Copy rows from `Volunteers_Confidential` to [dbo].[Volunteers_Confidential]
    The new target table will be created.
    Copy rows from `YearMonthTbl` to [dbo].[YearMonthTbl]
    The new target table will be created.
    The package will not be saved.
    The package will be run immediately.
    Provider mapping file : c:\Program Files\Microsoft SQL Server\100\DTS\MappingFiles\JetToMSSql9.xml"
    7.  I click the FINISH button and I get
    "Initializing Data Tasks .... Success"
    "Initializing Connections ...Success"
    "Setting SQL Commend ....20% Compoete"
    "Setting Source Connection ...Error (and an error link)"
    (All following tasks were "Stopped"
    Error detail is:
    ===================================
    Could not connect source component.
    Error 0xc020801c: Source - ParentingStats [1]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
     (SQL Server Import and Export Wizard)
    ===================================
    Exception from HRESULT: 0xC020801C (Microsoft.SqlServer.DTSPipelineWrap)
    Program Location:
       at Microsoft.SqlServer.Dts.Pipeline.Wrapper.CManagedComponentWrapperClass.AcquireConnections(Object pTransaction)
       at Microsoft.SqlServer.Dts.DtsWizard.Execute.SetSourceConnection(Exception& ex, TransformInfo ti)
    OS is Vista Home Premium SP1 (32 bit)
    Processor = Intel core 2 duo E7200 @ 2.5 GHz
    SQL Server Software was just downloaded yesterday, so it is whatever is current on the download site:
    SQL Express with Tools
    So, how do I get this transform to work?  I do not have nor do I want/afford to put Access 2003 on this machine.
    Thanks
    RRR

    I had this similar problem - 32-bit SQL Server 2005 trying to import tables from Access 2000 .mdb file, same error:
    Error 0xc020801c: Source - ParentingStats [1]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
     (SQL Server Import and Export Wizard)
    ===================================
    Exception from HRESULT: 0xC020801C (Microsoft.SqlServer.DTSPipelineWrap)
    I know you said you clicked "Advanced..." and Test Connection when you chose your Access database - but that is what resolved the error for me.  I chose my .mdb file, username is admin, password is blank, but if I don't click the Advanced button and test the connection before continuing on, the import fails with above error message.  Go figure, since the username/blank password is correct. 
    FWIW, sorry if that doesn't help you though.

  • Update SharePoint list programatically twice a day with SQL 2008 r2

    How complicate is to sustain the update  SharePoint list programatically twice a day by using SQL job?
    the data need  to be update twice a day and it is going o be use to feed a share point form...where the user(S) will be choosing by lookup in infopath form.
    BTW..I do not have control of the SharePoint farm, I have MS SQL 2008 R2 and SharePoint version is 2010. 
    Or Also I am considering to use  MS access 2010 and SharePoint version is 2010.
    CRISTINA&amp MICROSOFT Forum

    >DRAFT IDEA<
    Is this will corrupt SharePoint if I try this?
    The two data list that I want to update twice a day come from other database sources
    One is from Human Resources roster list. (The result of the query) –amount of records >> 600
    UNREAL
    example
    Unique ID
    domain name
    Region
    Badge
    Full Name
    email address
    Manager
    Director
    EUROPE
    EMEA
    123456
    Bear, Charles
    [email protected]
    Hanc, Juilan
    Cano, Oscar
    AMERICAS
    ABU
    223456
    Ros, Adrian
    [email protected]
    Knight, Dexter
    Brown, Dexter
    ASIA-PACIFIC
    APJ
    323456
    Chen, Andy
    [email protected]
    Ducann, Scott
    Ginger, Jeff
    (JOIN) From the roster list connect with the User Information List "user
    credential"(/_vti_bin/UserProfileService.asmx) to allow me Create dependent drop-down by using these articles:
    https://claytoncobb.wordpress.com/2009/06/21/userprofileservice-extended/
    http://sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=172
    http://blogs.msdn.com/b/infopath/archive/2004/03/24/95529.aspx
    http://www.dotnetcurry.com/showarticle.aspx?ID=794
    http://www.codeproject.com/Articles/155829/SQL-Server-Integration-Services-SSIS-Part-Basics
    The second one comes from Account list. (The result of the query) –amount of records >> 22,000
    FAKE
    example
    Unique ID
    email_address
    account_id
    account_lk_id
    account_name
    subdivision_region_name
    subdivision
    support_model
    [email protected]
    22650
    22649
    NANA Web Skills
    AP
    Martial Law
    PunkingSPlus
    [email protected]
    16624
    16624
    ELECTRIC FOOD
    AMER
    Short Circuit Blue
    PunkingSPlus
    [email protected]
    12538
    12538
    100 Got drunk
    EMEA
    100 Got drunk
    PunkingSPlus
    [email protected]
    22206
    22205
    911 Hospital Ghost
    AP
     Hospital AP
    PunkingSPlus
    [email protected]
    6886
    6886
    Administration for UFO LAND
    AP
    Xiamen
    PunkingSPlus
    [email protected]
    22242
    22241
    ACT  Recording
    EMEA
    ACT  Recording  Orange
    PunkingSPlus
    (JOIN) In this list I will need to do the same connect with the User Information List "user
    credential"(/_vti_bin/UserProfileService.asmx)
    To narrow these lists to what they are only responsible to work..
    These two tables are going to be part of InfoPath form ...
    with these draft idea , Do I need to be considering to be using what you suggest ? >>>"PowerShell
    availabe in SQL and the CSOM to interact with SharePoint "
    Could be possible that you can also provide an article?? relate to ....
    "Firstly you must not update SharePoint content databases directly from SQL. Doing so may
    corrupt your farm and will render it unsupported by Microsoft."
    Thanks in advance
    CRISTINA 

  • SQL 2008 R2 Cluster | change Cluster Disks

    Hello,
    We have a SQL cluster (for SharePoint 2010) consists of two nodes Windows server 2008 R2 & SQL 2008 r2.
    The SQL cluster have MSDTC (Clustered) & SQL services, with total four disks:
    Quorum Disk
    MSDTC Disk
    Databases disk
    Logs disk.
    Now the old SAN will be decommissioned and new LUNs have added to replace the our disks above. I managed to change Quorum & MSDTC. I used the below robocopy command to copy databases and logs with the same folder structure and permissions:
    robocopy t:\ l:\ /E /MIR /SEC /COPYALL /V
    I stopped SQL services then swapped drive letters , when I start SQL services it starts without problems (using the new Disks).
    But the issue is when I connect to SQL management studio, all databases are in suspect mode. I know there some SQL query to be run against each database , but this a production environment and I don't want to mess with it.
    Is there any other way to change cluster disks of SQL cluster? or use the above method without getting into suspect mode?
    Thanks, Shehatovich

    Hello, Shehatovich
    I you have copied the files while there were still online, that might have been the cause 'suspect' state of your databases.
    I would suggest you to follow the steps:
    Add the new disks to cluster, with validation in every single Cluster node (then cluster will be able to get the signature of the disks)
    Stop SQL Server service.
    Copy the MDF and LDF to the new disks,
    use the Detach and attach Method.  (http://msdn.microsoft.com/en-us/library/ms187858.aspx)
    After check tha your databases are online and consistent.
    Stop SQL Server service again and remove the disks
    Hope it may help you...
    Regards,
    Edvaldo Castro
    Edvaldo Castro http://edvaldocastro.com MCITP Database Administrator on SQL Server® 2008 MCITP Database Administrator on SQL Server® 2005 MCTS: SQL Server® 2008 MCTS: SQL Server® 2005 MCT: Microsoft Certified Trainer MTA: Microsoft Technology Associate
    MTAC – Microsoft Technical Audience Contributor CCSQLA – Cambridge Certified SQL Associate TOEIC – Test of English for International Communication

  • Installing SQL 2008 / SQL 2012 in a DMZ covered by RODCs

    Hello guys,
    I'm trying to install SQL 2008 (tried also SQL 2012) in a W2008R2 server that lives in a DMZ site covered by a couple of RODCs.
    The RODCs have full access to the RWDCs, but the traffic is blocked from the rest of computers in the DMZ to the RWDCs.
    Every time I run the wizard to install SQL server, it fails when trying to setup a domain user to run SQL services
    (“Server configuration >> Service Account” step). When I temporary allow the communication from that SQL Server to one of the RWDCs, it works.
    I have obviously cached and prepopulated passwords in the RODCs and I am using Domain Admins and non-domain admins accounts.
    We have more than 30 windows member servers authenticating against those RODCs in the DMZ and everything works fine.
    Any ideas why the SQL installation wizard cannot authenticate against a RODC? I have been googling and I didn’t find anything!
    Btw, I have already posted a similar thread in the SQL forum. They suggested to "install SQL Server with a local Windows
    account and then change the SQL Server service account with to the Domain account". That actually works, but I'd like to find out what is wrong my RO AD setup or this is a just an expected
    behavior in SQL installations covered by RODCs.
    Thanks.

    Any update about the issue?
    Mahdi Tehrani   |  
      |  
    www.mahditehrani.ir
    Please click on Propose As Answer or to mark this post as
    and helpful for other people.
    This posting is provided AS-IS with no warranties, and confers no rights.
    How to query members of 'Local Administrators' group in all computers?

  • Check SQL 2008 standard or enterprise

    Hi, how can I check sql 2008 edition except running query on sql browser? Or can I check this information from registry?

    Hi,
    Log into SQL Server Right  click on SQL Server instance and select properties SQL server proerties windows will appear On General Tab you can see Product section. Please see below screenshot
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

Maybe you are looking for

  • TS3899 Email randomly not working

    Since we changed our password the email doesn't consistently work.  I Receive the message The user name or password for imap.mail.yahoo.com is incorrect. I've powered off, deleted and re added account, cleared cookies, data and history and various co

  • Windows 8 to windows 8.1 update failure

    hello everybody. I updated my laptop, hp envy ts touchsmart sleekbook 4-1202ea, from windows 8 to windows 8.1. It is giving boot configuration data is missing some information with error code 0xc0000034. Whenever I power on my laptop it shows me the

  • Firewire & OS 8.6

    Doesn't Firewire require at least OS 9.x, or will it run under OS 8.6 if the 8.6 installation included a Firewire extention (driver)? I just installed a firewire pci card on my PM9600. The firewire all works when I boot into OS 9, but the firewire dr

  • How come itunes only downloaded part of a song?

    I bought a a couple of albums off of itunes and on one song (that i know of) on each album only plays part of the song. For example: if you have a 3:45 song it will only play 2:35 of the song and then it cuts off and moves onto the next song on the a

  • DHCP DNS Management Console Error

    Downloaded the DHCP DNS Management Console and logged in......login error ERROR_INCORRECT_PORT_IP New to linux. thanks for your help