Hello,I have about 6000 XML files need to import data to SQL tables. The data is not in specific fromat. End users filled Infopath forms and saved as XML document. Now i need to find out those fields and create new tables the import data.I tried using SSIS but when i locate XML file in XML source it says "Xml Source adaptor does'nt support mixed content model on complex types". I think data more comples for SSIS to handle. But i cant do anything with data.Is there any other option to import XML data like Queries or stored procs in SSMS. I heared that we can do in XQuery, but not sure.please reply me if anyone get idea about this..Thanks in advance!Kumar
↧
Import XML Data into SQL tables
↧
LOB data types
Hi,I am using SQL Server 2008 R2 and just wanted to know which data types are included as LOB.So far I have:TEXTNTEXTIMAGEVARCHAR(MAX)NVARCHAR(MAX)FILESTREAMXMLVARBINARYHowever, when I run my online index rebuild, it is failing on types of nvarchar as it sees this as being a LOB data type. Would it also include bigint as a LOB data type?Is Varbinary(max) seen as a LOB type as well?
↧
↧
SSIS 2008 execution failure from SQL Agent
When I run the SSIS package it runs succesfully, if I use proxy (my credentials) it runs fine from SQL Agent.But, if I use SQL Agent Service to run the SSIS package it fails with this error message:Error: 2016-08-24 16:56:57.99 Code: 0xC0029151 Source: Decrypt file Execute Process Task Description: In Executing "C:\Program Files (x86)\GNU\GnuPG\gpg2.exe" "--output F:\Ele\test\PT_08212016_1 -d F:\Ele\PT_08212016_1.pgp" at "C:\Program Files (x86)\GNU\GnuPG\", The process exit code was "2" while the expected was "0". End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 4:56:55 PM Finished: 4:56:57 PM Elapsed: 2.262 seconds. The package execution failed. The step failed.
↧
Insert changed data
Dear all,I'm trying to find out the best why of inserting into a column e.g "ChangedData" if it has either been 'updated', 'deleted' or inserted.Thank you in advance!
↧
Executing dynamic functions in table select
Good Morning I have a request to calculate de holidays of districts for a given yearTo calculate them i have a formula in a column of the Districts tableI reach this solution, it works fine, but it seems uggly, i'm asking for a better solutioni can create any function to populate that columnTake this simplified example:i have my table with the "code" of the function in the FNC columni have 4 functions (could have many more)than i have a procedure to list the table with the new calculated columni tryed to create a function that uses sp_execsql to calculate the given function, but as you know is not possible ...Any ideas?[code="sql"]CREATE FUNCTION dbo.dummyFuntion1(@YEAR INT) RETURNS INTASBEGIN DECLARE @ret INT SET @ret = @YEAR RETURN @retENDCREATE FUNCTION dbo.dummyFuntion2(@YEAR INT) RETURNS INTASBEGIN DECLARE @ret INT SET @ret = @YEAR + 1 RETURN @retENDCREATE FUNCTION dbo.dummyFuntion3(@YEAR INT) RETURNS INTASBEGIN DECLARE @ret INT SET @ret = @YEAR - 1 RETURN @retENDCREATE FUNCTION dbo.dummyFuntion4(@YEAR INT) RETURNS INTASBEGIN DECLARE @ret INT SET @ret = @YEAR - 2 RETURN @retENDCREATE TABLE MainTable (ID INT identity(1,1), FNC VARCHAR(200))INSERT INTO MainTable VALUES('dbo.dummyFuntion1(@YEAR)'),('dbo.dummyFuntion2(@YEAR)'),('dbo.dummyFuntion3(@YEAR)'),('dbo.dummyFuntion4(@YEAR)')SELECT * FROM MainTableCREATE PROCEDURE dbo.dummyProcedure @YEAR INTASBEGIN DECLARE @query VARCHAR(MAX) SET @query = '' SELECT @query = @query + COALESCE( ' SELECT ID, FNC, ' + REPLACE( FNC, '@YEAR', CAST(@YEAR AS CHAR(4)) ) + ' AS Calculated ' + ' FROM MainTable WHERE ID = ' + CAST(ID AS VARCHAR(100)) + ' UNION ALL ' , '') FROM MainTable SET @query = SUBSTRING(@query, 1, LEN(@query) - LEN(' UNION ALL ')) PRINT @query EXEC (@query)ENDEXEC dbo.dummyProcedure 2016DROP FUNCTION dbo.dummyFuntion1DROP FUNCTION dbo.dummyFuntion2DROP FUNCTION dbo.dummyFuntion3DROP FUNCTION dbo.dummyFuntion4DROP TABLE MainTableDROP PROCEDURE dbo.dummyProcedure[/code]
↧
↧
ReportServer for endpoint 2, error=b7.
Hi,I have problem with SSRS. Sometime on the week at 5 am SSRS service stop and It don't run.In log I have error:Failed to register url=http://:80/ReportServer/ for endpoint 2, error=b7.rshost!rshost!1084!08/25/2016-05:00:50:: w WARN: Endpoint 2 is enabled but no url is registered for vdir=/ReportServer, pdir=C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer.servicecontroller!DefaultDomain!2b48!08/25/2016-05:00:51:: e ERROR: Error creating HTTP endpoint. System.Runtime.InteropServices.COMException (0x800700B7): You can not create a file that already exists. (for HRESULT: 0x800700B7) w Microsoft.ReportingServices.HostingInterfaces.IRsUnmanagedCallback.CreateHttpEndpoint(RsAppDomainType application, String[] urlPrefixes, Int32 cPrefixes, String[] hosts, Int32 cHosts, Boolean wildCardPresent, String virtualDirectory, String filePath, Int32 authType, Int32 logonMethod, String authDomain, String authRealm, Boolean authPersist, Int32 extendedProtectionLevel, Int32 extendedProtectionScenario, Boolean enabled) w Microsoft.ReportingServices.Library.ServiceAppDomainController.SetWebConfiguration(RunningApplication rsApplication, Boolean enabled, String folder)When I run service, I don't have problem. Service start correct.How can I solve this problem?
↧
hashing a value
we are trying to hash a field. If the field value is same it should return the same hash values. We don't want to use sha1. Is there any other solution?
↧
Load data using SSIS
Hi friends, We need to develop a SSIS package to load data from ftp site onto SQL Server tables. After some research I found that I cannot import data directly from ftp and I will have to get the file to the SQL DB server first and do the import to the tables. I tried to create a SSIS package for this as below: 1. Created FTP task to receive files, put the file locally on the db server. Set DelayValidation-TRUE 2. Created data flow task: Flat file source. (prompted for the source file, I read somewhere to create a dummy file just for the design work and later removed the flat file before execution). Data conversion OLE DB destination to the SQL Server table. When I run the package, I get the below error:Error: 0xC001602A at test, Connection manager "FTP Connection Manager": An error occurred in the requested FTP operation. Detailed error description: The password was not allowed There is no password saved in the connection manager for the FTP task... Not sure what I'm missing... Can you please help me fix this problem. Thank you all so much
↧
How to generate a HTML in chart in SQL and send via db mail ?
Hello All,I'm trying to find guidance on how to create a HTML generated chart off a very simple query that I can then schedule through db mail. I found a video on youtube but its of bad quality and the speaker does not speak English. I know it sounds silly, but i'd like to see how to do it, its kind of one of those things thats not necessary but i'd like to learn how anyway. It would be rendered via outlook 2010. (My database mail is completely set up. Just need help on this chart style message)Any help appreciated !!![code="sql"]SELECT j.name AS [Job Name], s.step_id AS [Step Number], s.step_name AS [Step Name], DATENAME(MONTH,msdb.dbo.agent_datetime(run_date, run_time)) AS [Run Month], CAST(msdb.dbo.agent_datetime(run_date, run_time) AS DATE) AS [Run Date], msdb.dbo.agent_datetime(run_date, run_time) AS [Run Date Time], ((run_duration/10000*3600 + (run_duration/100)%100*60 + run_duration%100 + 31 ) / 60) AS [Run Duration Minutes]From msdb.dbo.sysjobs j INNER JOIN msdb.dbo.sysjobsteps s ON j.job_id = s.job_idINNER JOIN msdb.dbo.sysjobhistory h ON s.job_id = h.job_id AND s.step_id = h.step_id AND h.step_id <> 0WHERE j.ENABLED = 1 ORDER BY [Job Name], [Run Date Time] ASC[/code]
↧
↧
Inserting into unindexed table - slowly after migration?
Sever DBs have just been migrated from SQL 2005 to 2008, pretty much the same spec/hardware/settings. There are two main DBs, the first one is operational, and it immediately needed stats updating to perform efficiently. The second DB is used for ODS and has a nightly movement of data from the operational DB.The first time the data move took place instead of taking its normal 3.5 hours it ran for 17 hrs :crying:. The migration is a series of select/insert statements, but it appeared to be the inserts that were taking the time to be performed. The destination tables have all indexes and constraints dropped at the start of this load and re-added at the end.Should the fact that there was no stats update performed on the ODS DB cause inserts to be slow when the tables had no indexes??? My hunch is that it shouldn't - am I wrong?
↧
Need help with Conditions in SQL Query
I'm only listing snippets of the query which are sub queries. Below sub query displays the month if a certain task (TaskID 1) is closed on the same month or displays "0" if it is not closed in the same month. Plus it displays the activity note in detail for that ONE task(Task ID 1). this is all working fine for me[code="sql"](SELECT Top 1 case when Month(TaskFinish)=Month(TaskSTart) THEN Month(TaskStart) ELSE '0' END FROM Tasks T WHERE ticketid = 140 And TaskID=1 AND ttype =1 ORDER BY TaskSTart desc) [TaskStartClosedMonth],(SELECT Top 1 Response FROM Tasks T INNER JOIN Response2 R ON R.QAssignID=AssignID WHERE T.ticketid = 140 And T.TaskID=1 AND ttype =1 ) [ResponseDetail],[/code]The above queries is for only ONE Task. I need to incorporate 3 tasksI need to display the month for ANY of the THREE tasks (TaskID1,TaskID2,TaskID3) that were started and closed in same month, if no match found then display 0. If it finds a match say for TaskID 2 , then give me the response for TaskID 2. In TSQL it would have been listtle easy to do that but I need to get this done in SQL query. I believe we will have Case satements and conditions?please advise
↧
extract tar.tz file in SSIS
Hi,I want to extract tar.tz file. for this I tried below command in command line using 7z.exe and it extract files7z x -y "c:\test\test.tar.gz" -so | 7z x -y -aoa -si -ttar -o"c:\test\1\"however, when I am trying to extract using ssis, it's not working. I am getting error code 7, which means there is some problem in arguments. In ssis, I am using "Execute process task" and in executable property I am giving path "C:\Program Files (x86)\7-Zip\7z.exe" and in argument I am passing x -y "c:\test\test.tar.gz" -so | x -y -aoa -si -ttar -o"c:\test\1\" even tried with x -y "c:\test\test.tar.gz" -so | 7z x -y -aoa -si -ttar -o"c:\test\1\" but still not working.Can any one has done this.Please help.
↧
Running multiple servers script
Hi community,Sorry to publish this question on friday :cool::angry:Here is the question:I'm running a server farm with 25 inherited sql server (EE) instances (SQL Server 2008, SQL Server 2008 R2)the site management is not very sure about how long or if finally all their backups are working fine, some are very lenghty in time.What could be my best option, to run a script to just check what databases are backed up day after day, also consider that they are running a third party "data protection suite" that connects to each instance a do their job. I have done my script, it runs fine in just one instance, but when I see other instances, I could see that the task is not fully completed. Would I need to copy my script in each server and run it ???.How could I run an unattended task to check all my servers, this servers are not linked, or perhaps I am demanding too much for SQL Server ?I'm only checkingPerhaps some of you have a clear point of view, sorry for the question I am newbie with SQL Server 2k8Thanks for your ideas
↧
↧
southern hemisphere and not in
[url=http://genglobal.org/content/nzaus-new-zealand-vs-australia-li.ve-s-tre.am-all-blacks-wallabies-previewonline-27-aug-2016]New Zealand vs Australia Live Streaming[/url]
↧
Unable to delete an obsolete job SS208R2
Cleaning up a bit, I found an old job that has been failing for a while. It's a maintenance job, supposed to be doing weekly backups.This is a personal instance, mostly used for testing locally, so no critical data has been endangered. :-DTrying to delete it fails with this error:"The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id". The conflict occurred in database "msdb", table "dbo.sysmaintplan_subplans", column 'job_id'."Before I get really crazy here, is there a way to delete the job via an alternative method?I could just disable it and create a new one, but, well, now that I know it's a problem, I HAVE to fix it. Preferably deleting it, but I guess if I can't, then I need to determine why it's now failing and address that. I suspect it's got something to do with the account under which it runs.Thanks in advance.
↧
SQL Server 2008 R2 Agent not start after boot
Hello I have a problem with the SQL Server 2008 R2 Agent not start after boot. If after boot I start manually starts perfect. I went to the SQL Logs and I see this in the SQL Agents Logs:[b]08/27/2016 09:19:35,,Information,[098] SQLServerAgent terminated (normally)08/27/2016 09:19:34,,Error,[000] Failed to load any subsystems. Check errorlog for details.08/27/2016 09:19:34,,Error,[165] ODBC Error: 0<c/> Unable to complete login process due to delay in opening server connection [SQLSTATE 08001][/b]Before that error I see in log of SQL in Windows NT section these errors:[b]Date 8/27/2016 9:18:35 AMLog Windows NT (Application)Source WinMgmtCategory (0)Event 3221231089Computer schoolMessageThe description for Event ID '-1073736207' in Source 'WinMgmt' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event:[/b][b]Date 8/27/2016 9:18:35 AMLog Windows NT (Application)Source MSSQLSERVERCategory LogonEvent 3221243928User NT AUTHORITY\SYSTEMComputer schoolMessageLogin failed for user 'NT AUTHORITY\SYSTEM'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>][/b]What could be the problem of the SQL Server agent that could not start automatic after reboot?
↧
several other celebrities turned him down
[url=http://genglobal.org/content/mtv-video-music-awards-l-ive-s-trea-m-2016-award-show-28-aug]MTV Video Music Awards 2016 Live Streaming[/url]
↧
↧
Ad hoc update to system catalogs is not supported.
Following query is executed to enable the filestreaming on sql server instance:EXEC sp_configure filestream_access_level, 2;GORECONFIGURE;GOBut I get following information.Configuration option 'filestream access level' changed from 2 to 2. Run the RECONFIGURE statement to install.Msg 5808, Level 16, State 1, Line 1Ad hoc update to system catalogs is not supported.My question is: Even though this says that the Ad hoc updates are not supported, 'filestream access level' value is chagned from 0 to 2.
↧
Hard time determining sarcasm? Nooooooo!
[url=http://genglobal.org/content/smart.tv-bengals-vs-jaguars-li.v.e-st-r-e-m-nfl-28th-august-nbc.tv]Bengals vs Jaguars live streaming[/url]
↧
by the removal of the upper tiers of seating
[url=http://genglobal.org/content/fox.tv-us-open-2016-li.ve-s-tre.am-tennisschedule-onlinepredictions-..28-august-2016]US Open 2016 Live Streaming[/url]
↧