Quantcast
Channel: SQLServerCentral » SQL Server 2008 » SQL Server 2008 - General » Latest topics
Viewing all 16406 articles
Browse latest View live

Not related to sql - Unlock password protected .7z file.

$
0
0
Hi Guys,How to unlock or recover or extract password protected folder that is archived using .7z zip.I have been searching for 2 days and not found working solution for this.I have tried with 7zcracker and unlock rar password remover s/w, none of them worked.Please let me know is there any third party tool or s/w that do this work.Thnx in advnc.

linked ole objects in table

$
0
0
In our database we have a table with pdf documents linked as an ole object in a field. The field is not readable. We recently switched servers that the object is linked to. Is there a way to read this field and changed the path?

EXECUTE permission denied on xp_instance_regread

$
0
0
I have a user that just received a new computer and is now is getting the error "The EXECUTE permission was denied on the object 'xp_instance_regread'" on one particular instance. They are getting the error when they try to right click on a table name in object explorer. This isn't all that confusing in and of itself, except that they only get it when connecting from their new machine. Their old machine will still works just fine. They don't get the error when connected to other instances either. Because they don't get the error when connected from another machine it doesn't appear to be a sql server permissions problem. I can grant them execute on the xp but I'm afraid that is just bandaiding the problem and we are going to see more issues in the future if the real problem isn't found and corrected.Any help or even a direction to look would be appreciated.

Confusion Over OR and And Operators

$
0
0
Suppose I want to find customers in the customers table who are not in the US or the UK.To me the query for the above requirements would be as follows:[code="sql"]Select * from customers where country != 'US' AND country !='UK';[/code]However, I've seen people write the query for the above requirements as follows:[code="sql"]Select * from customers where Not(country = 'US' OR country ='UK');[/code]Please explain which one is correct, thanks.

Find all dates between date ranges in a table; Prefer tally table solution

$
0
0
I suspect there is both a CTE and a tally table solution here but I would prefer the tally solutionGiven a table of start and end dates I want to generate a distinct list of dates including the dates between the start and end date of each record[code="sql"]DECLARE @DateRanges TABLE( StartDate DATE, EndDate DATE)INSERT INTO @DateRanges (StartDate,EndDate) VALUES ('2016-12-01','2016-12-01')--2016-12-01INSERT INTO @DateRanges (StartDate,EndDate) VALUES ('2016-12-01','2016-12-02')--2016-12-01 and 2016-12-02INSERT INTO @DateRanges (StartDate,EndDate) VALUES ('2016-12-04','2016-12-06')--2016-12-04, 2016-12-05, 2016-12-06INSERT INTO @DateRanges (StartDate,EndDate) VALUES ('2016-12-08','2016-12-11')--2016-12-08, 2016-12-09, 2016-12-10 and 2016-12-11INSERT INTO @DateRanges (StartDate,EndDate) VALUES ('2016-12-10','2016-12-12')--2016-12-10, 2016-12-11 and 2016-12-12INSERT INTO @DateRanges (StartDate,EndDate) VALUES ('2016-12-15','2016-12-15')--2016-12-15SELECT * FROM @DateRanges[/code]--Desired results--2016-12-01--2016-12-02--2016-12-04--2016-12-05--2016-12-06--2016-12-08--2016-12-09--2016-12-10--2016-12-11--2016-12-12--2016-12-15Appreciate any assistance offered.

I'm scared to delete log file

$
0
0
Hi,I have two files i.e [b] .ldf[/b] and [b].mdf[/b] in my disk. As we know these are normally SQL Server database log and data files. ......I'm not sure if these files are currently being used by any databases or not or they are simply lying in the system and redundantHow do I check if these files are used by databases or not ? Basically I'm planning to delete these files to save some space in disk. Is there any way I can be certain that these files are redundant and in that case I can safely delete these files ?

Print file names

$
0
0
what is command to print current ldf and mdf file names used by all respective databases in my SQL Server 2008 R2 DB ?

ReportServerTempdb log file is full

$
0
0
Hello,Our ReportServerTmpdb log file is full and our reports are receiving this error. i'm trying to understand, what causes this log file to grow and how can we prevent this ? Database is in simple recovery mode so we cannot take log backup.Can anyone please help me on this ?

CASE with COUNT

$
0
0
Hi all,I got my join tables and displayed what I needed:- ClientId- NI Number- Contribution AmountSo of course I have multiple contributions for one client meaning multiple rows like:Client 1 NINUmber Contribution of 1100.00Client 1 NINUmber Contribution of 3250.00Client 1 NINUmber Contribution of 4500.00I need to have an additional column, let's say 'Contribution above limit' that counts the total contribution for the client and if it is above the limit - let's say 7500 - a message is displayed like 'Total over £7,500'So far I have it sorted when the actual amount is above 7500 but not the total of all the contributions for the client.Thank you in advance for your help.Celine

Backup Job and Cleanup Task using Windows Batch job

$
0
0
Hi ExpertsI want to write a windows batch file, to take backup file and once the backup is taken successfully, want to delete the backup files older than 7 days.How to use a IF condition with the backup step that when it is successful, then the next step (delete) will run. Please suggest.sqlcmd -S . -Q "EXEC sp_BackupDatabases @backupLocation='D:\Folder\', @backupType='F'" REM Remove files backup older than 7 daysforfiles /p 'D:\Folder\' /s /m *.* /c "cmd /c Del @path" /d -07

is it possible to setup trans replication between 2005 to 2012 ent to ent edition

$
0
0
I got the below error when I tried setting up trans replication.Pub is 2005 entSub is 2012 entWhen I tried to add the sub, that's when I get the below error.TITLE: New Subscription Wizard------------------------------The selected Subscriber does not satisfy the minimum version compatibility level of the selected publication.------------------------------

Replication Sync issue

$
0
0
Replication monitor says all caught up and 0 commands in distributer to send to subscriber side.However, I do see row counts different in some of the replicated tables.How do I troubleshoot this further, any thoughts plz.Thanks.

SUm up XML field data based on conditions

$
0
0
HiI'm trying to sum up an XML(XML DATA BELOW) field based on if conditions apply so in my case, the XML tag of "PROMTN"(where N = 1 - 12 ) Is either "Collateral" or "Direct" I want to end up with a sum for Direct and a sum for collateral I've got something like this going, but not getting anywhere.... ThxJoeSELECT dbo.XDocuments.ObjectID,CASE WHEN Data.value('(/Data/Prompt1)[1]', 'nvarchar(10)') ='Collateral' AND Data.value('(/Data/Crisis_x0020_Assessment)[1]', 'nvarchar(10)') ='TRUE' then SUM(cast(Data.value('(/Data/Crisis_x0020_Assessment_x0020_Minutes)[1]', 'int')AS INT)) END AS TEST FROM XDocuments INNER JOIN ObjectMetadata AS om INNER JOIN CalendarEvents ON om.ObjectID = CalendarEvents.ParentObject ONXDocuments.ObjectID = om.ObjectIDWHERE ...GROUP BY .....XML DATA <Data> <Total_x0020_Minutes>78</Total_x0020_Minutes> <Day>1</Day> <Contact_x0020_Type>In-Person Meeting</Contact_x0020_Type> <Functioning>TEST</Functioning> <Crisis_x0020_Assessment>true</Crisis_x0020_Assessment> <Prompt1>Collateral</Prompt1> <Crisis_x0020_Assessment_x0020_Minutes>1</Crisis_x0020_Assessment_x0020_Minutes> <Crisis_x0020_Assessment_x0020_Details>Crisis Assessment</Crisis_x0020_Assessment_x0020_Details> <Tx_x0020_plan>true</Tx_x0020_plan> <Prompt2>Direct</Prompt2> <Tx_x0020_Plan_x0020_Minutes>2</Tx_x0020_Plan_x0020_Minutes> <Tx_x0020_Plan_x0020_Details>Treatment Plan/ Team Meeting:</Tx_x0020_Plan_x0020_Details> <Risk_x0020_Management_x002F_Safety_x0020_Plan>true</Risk_x0020_Management_x002F_Safety_x0020_Plan> <Prompt3>Collateral</Prompt3> <Minutes3>3</Minutes3> <Details3>Risk Management/Safety Plan:</Details3> <Consult_x0020_with_x0020_Supervisor>true</Consult_x0020_with_x0020_Supervisor> <Prompt4>Direct</Prompt4> <Minutes4>4</Minutes4> <Details4>Consult with Supervisor:</Details4> <Consult_x0020_with_x0020_MD>true</Consult_x0020_with_x0020_MD> <Prompt5>Collateral</Prompt5> <Minutes5>5</Minutes5> <Details5>Consult with MD:</Details5> <Documentation>true</Documentation> <Prompt6>Direct</Prompt6> <Minutes6>6</Minutes6> <Details6>Documentation:</Details6> <Telephone_x0020_Support>true</Telephone_x0020_Support> <Prompt7>Collateral</Prompt7> <Minutes7>7</Minutes7> <Details7>Telephone Support:</Details7> <Collateral_x0020_Contact_x002F_Coordination>true</Collateral_x0020_Contact_x002F_Coordination> <Prompt8>Direct</Prompt8> <Minutes8>8</Minutes8> <Details8>Collateral Contact/Coordination:</Details8> <Referral_x002F_linkages>true</Referral_x002F_linkages> <Prompt9>Collateral</Prompt9> <Minutes9>9</Minutes9> <Details9>Referral/linkages:</Details9> <Family_x0020_Psycho-Education>true</Family_x0020_Psycho-Education> <Prompt10>Direct</Prompt10> <Minutes10>10</Minutes10> <Details10>Family Psycho-Education:</Details10> <Parent_x0020_Support>true</Parent_x0020_Support> <Prompt11>Collateral</Prompt11> <Minutes11>11</Minutes11> <Details11>Parent Support:</Details11> <After_x0020_Care_x0020_Services>true</After_x0020_Care_x0020_Services> <Prompt12>Direct</Prompt12> <Minutes12>12</Minutes12> <Details12>After Care Services:</Details12>

Analyze Table structure for best data type

$
0
0
Hi,I have a table that was imported from Oracle and all numeric data type were transferred as numeric (38,0). I am looking for a tool\script to analyze the data in each column of a table and recommend an appropriated datatype. For example, a column has a min value of 0 and a max value 1,000,000. Recommendation would be to use an INT datatype.Thanks

Data update

$
0
0
I have data "2016-11-10 12:12:42.100" in table column UPDATED_DATE.my where clause is ...WHERE CONVERT(varchar(11),UPDATED_DATE,103) BETWEEN '01/12/2016' and '13/12/2016' order by updated_date descThis where clause is returning data "2016-11-10 12:12:42.100" in resultset.I was not expecting the data to be returned since its from the November month.What fix I require in my where cause ?

Log waits

$
0
0
Dear All,I have a database which is causing job failure looking from the error logs, it states that the log wait should be checked and when checking the results are:Logwait description = backup Logwait = 2 The full backup was successful and also the transactionl log backup.Would anyone be able to let me know what else requires to be checked please?Thank you in advance!

Filtered statistics

$
0
0
Hi,Does anyone have any links / good information about creating filtered statistics on partitioned tables? Tantalisingly, I've found references to a SQLCAT blog on the subject, but can't find the actual article :(Why I am interested - I have a few tables that have between 1billion - 20billion rows each. They're monthly partitioned and I am considering creating filtered statistics along the same line as the partitioning key. Queries generally select data from the latest partition. I am considering filtered statistics because:a) Concentrated sampling of the partition rather than the whole table, giving a better picture of data distributionb) Maintenance - I'm currently updating stats with a 1% sample on these big tables due to the time taken and i/o caused. Hopefully filtered stats will make maintenance a bit easier, for example, update filtered stats daily and regular stats less frequently. Auto update stats is off on these tables.It's SQL Server 2008 R2 Enterprise Edition. We only do reorg's of the partitioned indexes (aligned) as we can't afford for them to be offline, plus you can't do an online index rebuild of a single partition in our version. This of course means that stats need to be done manually, as opposed to index stats being done with an index rebuild.Thanks

run a console application by using SQL Server Agent

$
0
0
Hi,I would like to run a console application (vb code written on visual studio) by creating a CmdExec in SQL Server Agent.According to the tutorial http://www.sqlservercentral.com/articles/Stairway+Series/72459/ It works when I typed in "dir c:\" for the command.But how can I execute my console application?Path => C:\Code\Nota 2011\Nota-Unit-3\Nota\ConsoleOutlookIntegrationFile name => Module1.vbProject name => ConsoleOutlookIntegration.vbprojThanks in advance,

NULL Datetime causing NULL string when converting

$
0
0
Here's the Query:[code="sql"]SELECT [description],CASE WHEN startDate IS NULL THEN CASE WHEN endDate IS NULL THEN '(''' + [description] + ''',''' + 'NULL' + ''',' + '''' + 'NULL' + ''',''' + code + ''')' ELSE '(''' + [description] + ''',''' + 'NULL' + ''',' + '''' + CONVERT(VARCHAR(8), enddate, 112) + ''',''' + code + ''')' ENDELSE'(''' + [description] + ''',''' + CONVERT(VARCHAR(8), startdate, 112) + ''',' + '''' + CONVERT(VARCHAR(8), enddate, 112) + ''',''' + code + ''')'ENDFROM POS_CODEVALUE WHERE CODETABLE_FK = 12[/code]I was thinking the nested CASE Statements would account for the NULL values within start/end date - but it's not. During the conversion, any record which has a NULL in those dates (in this instance, End Date) returns the full string as NULL.If we use these following scripts:[code="sql"]DECLARE @TESTDATE DATETIME;SET @TESTDATE = GETDATE();SELECT 'TEST-' + CONVERT(VARCHAR(8),@TESTDATE,112)GODECLARE @TESTDATE DATETIME;SET @TESTDATE = NULL;SELECT 'TEST-' + CONVERT(VARCHAR(8),@TESTDATE,112)GODECLARE @TESTDATE DATETIME;SET @TESTDATE = NULL;SELECT CASE WHEN @TESTDATE IS NULL THEN 'TEST-' + 'NULL' ELSE 'TEST-' + CONVERT(VARCHAR(8),@TESTDATE,112)END AS testconvertDATEGODECLARE @TESTDATE DATETIME;DECLARE @TESTENDDATE DATETIME;SET @TESTDATE = NULL;SET @TESTENDDATE = NULL;SELECT CASE WHEN @TESTDATE IS NULL THEN CASE WHEN @TESTENDDATE IS NULL THEN 'TEST-' + 'NULL' ELSE 'TESTDATE IS NULL, BUT TESTENDDATE IS NOT NULL' END ELSE 'TESTDATE IS NOT NULL, AND TESTENDDATE IS NOT NULL'END AS testconvertDATEGO[/code]We can see that the nested CASE logic SHOULD work.I'm not sure what I'm missing, can anyone identify where my logic is flawed?

Find who is changing advaced options in SQL 2008

$
0
0
we are keep getting following alert in SQLConfiguration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.I have enable the trace to see the but no luck,In my trace , I have enabled TextData,BatchStatrted,Batchended and couple of other columns as well.Appreciate your help
Viewing all 16406 articles
Browse latest View live


Latest Images