Friday, July 26, 2013

[SQL Server 2008 issues] Getting DateOfBirth of youngest person.

[SQL Server 2008 issues] Getting DateOfBirth of youngest person.


Getting DateOfBirth of youngest person.

Posted: 25 Jul 2013 06:49 AM PDT

Hi,i have table named PersonalData.In this table i have a column DateOfBirth.I want to get the person who is the youngest of all.For this what condition i should put on DateOfBirth column in Where clause.Please help.

SAN disk size expansion

Posted: 25 Jul 2013 04:04 PM PDT

Hi,We were trying to expand SAN disk size more than 2 TB as part our requirment. But it failed due to the limitation, NTFS can support maximum of 2 TB. Is it so? I am unaware such windows limitations! On the other way, how to work around and hot to expand a SAN disk more than 2 TB. Any suggesstion would be highly appreciated.My environment is: Windows Server 2008 R2, enterprise editionSQL Server 2008 R2, enterprise edition6 SAN disks are configured with >1 TB to < 1.5 TB. We want to expand those SAN disks to more than 3 TB each. Thanks!

retrieve database information from the server having only read-only permissions

Posted: 25 Jul 2013 05:10 PM PDT

Please help me on the below question . I faced this question in an interview.How to retrieve database information from the server having only read-only permissions and move it to another server?

2008/2005 views mapped to 2000?

Posted: 25 Jul 2013 07:57 AM PDT

Hi guys,[b]Synopsis[/b]Bored at work, I came up with the idea having (historical) monitoring of our SQL Server instances available on Oracle APEX pages like we do for our Oracle environments. My 2 main reasons for this are:1. experience/something to kill the time with2. rather amusingly we have hundreds of SQL Server instances but not a single DBA test server for SQL Server. My hope from this project is that it will convince my manager to give us our own server which would also act as the repository for forwarding to the Oracle DB.So I installed XE on my laptop & used it to test using Linked Servers. Having successfully passed data from remote SQL servers, into my laptop and then on to Oracle a colleague said I could use his team's server (since our laptops are repeatedly forced to sleep and so overnight jobs would not run). I've now got a database on his server collecting from 2005 & 2008 databases (11 servers in total).[b]Main point[/b]I can collect data from 2005 & 2008 databases OK but the queries would fail on 2000 due to views like sys.databases & I think SERVERPROPERTY was SERVERPROPERTYEX? Is there some .sql available online that will create 2005 views/functions in 2000?If not publicly available, has anyone done similar & is willing to share?Just so I know I'm not re-inventing the wheel~~

how to write a SQL report efficiently- Need help please

Posted: 25 Jul 2013 07:02 AM PDT

Dear friends,i have a task to write a business report that has 300 fields ( 200 from one table and 100 from another table) . Currently I'm creating a TEMP Table with all the report fields then inserting data into that from the 2 Source tables using Joins... , wanted to know a much better way with a sample of how do it.Also the business gives me the requiremenst in an excel i had to work hard to collect the fields from the excel and then align them to create Temo table, any easy way for to gather all the report fields from the excel and put them in SQL ?Kind RegardsDhananjay

how to download management studio express for 2008 R2

Posted: 25 Jul 2013 05:31 AM PDT

I can't seem to find a download link for Management Studio Express for 2008 R2.I found this:http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=22985But it is only the RTM version. Is there no download link for the GA (i.e. official) version?

add an url link in a pdf report using report builder

Posted: 25 Jul 2013 12:14 AM PDT

This seems to be a simple question but I haven't found a way to do it. I have a report in SSRS that I created using report builder 3.0. I have added a field which is tied to an action and opens a new window to another page. This report also has a subscription to run once a month and send the report as a PDF file to several users. However, once the subscription runs and creates a PDF file the link is lost. How do I add a url link to the report that still works on the pdf file?For the action expression I'm using ="void(window.open('http://www.somesite.com/Page.aspx?Param="+Fields!ParamValue.Value + "','_blank'))" Thanks.

Impersonation and connection pooling

Posted: 24 Jul 2013 09:04 PM PDT

Hi,I'm working on a project to improve the application and SQL Server security.We have some applications that access the server using SQL Server authentication and each application uses credentials that are stored in a table (OMG!) in clear text.A first connection is issued to retrieve the credentials (each application has its own credentials) and then a second connection is opened using those credentials.We can implement Windows Authentication, but I wanted to let people write on the database tables only when using the application. Application roles are not an option: some applications have to read and write data on multiple databases and I don't want to mark any database as trustworthy.The alternative I was planning to implement relied on the same SQL Server logins is use today, but not used directly. Basically, I wanted to grant IMPERSONATE permissions on specific Windows Groups and then issue a EXECUTE AS LOGIN as soon as a connection is open.This works great in SSMS, but it breaks in the application when connection pooling is used.As soon as I close the connection and return it to the pool, the connection gets dropped.The error I get is:The connection has been dropped because the principal that opened it subsequently assumes a new security context, and then tried to rest the connection under its impersonated security context. This scenario is note supported. See "Impersonation Overview" in Books Online.There used to be a property in the connection string to avoid resetting the connection (Connection Reset=false) but now it seems to be obsolete and removed: [url]http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.connectionreset.aspx[/url]I'm running out of options, any help would be greatly appreciated.

Conditional print for testing scripts.

Posted: 25 Jul 2013 12:52 AM PDT

Dear Reader,For testing I want to replace PRINT statements with a procedure call.A Global substitute should replace all 'PRINT' with 'EXEC iSPRINT'.In the procedure I can switch the printing ON (for testing) and OFF.See below the CALLs which I have tried.[b]Is there a simple/short solution for my problem where I do not have to edit each print statement ?[/b]Thanks,ben brugman[code="sql"]--------------------------- Wat I am looking for. (This does produce an error).iSPRINT 'This is a teststring to print time: ' +convert(varchar(30), getdate(), 126)iSPRINT 'A seconde teststring to print time: ' +convert(varchar(30), getdate(), 126)--------------------------- WORKS in isolaton :iSPRINT 'text 1 This is a teststring to print time: '--------------------------- WORKS in a script :exec iSPRINT 'text 1 This is a teststring to print time: 'exec iSPRINT 'text 2 This is a teststring to print time: '--------------------------- WORKS in a script :declare @string varchar(300) set @string = 'text 1 This is a teststring to print time: '+convert(varchar(30), getdate(), 126)exec iSPRINT @string = @stringset @string = 'text 2 This is a teststring to print time: '+convert(varchar(30), getdate(), 126)exec iSPRINT @string = @string[/code]

SQL 2008 SSIS package runs in BIDS but not job

Posted: 25 Jul 2013 12:29 AM PDT

I have a SQL Server 2008 64-bit SSIS package that runs just fine in BIDS. However, when i create and run the job, it fails saying it can't find the path for the checkpoint file. I have evaluated the expression that creates the path for the checkpoint file and it evaluates to the correct location.There are configuration files which go to a SQL server table. There is another configuration file which goes to an environment variable. I have deleted and added back in the configuration file and the environment variable that points to the path for the checkpoint file thinking it was cached somewhere. This didn't do anything.The SQL server table is SQL Server 2008 R2 SP2.It seems like the configuration files are not being applied to the job. The job runs under a proxy account, which has read access to the sql server table. I have logged into the server the SSIS package runs the job under in order to see if it would run in BIDS, it does. I have also deleted and recreated the job.

How can I write this in single select query ?

Posted: 24 Jul 2013 11:03 PM PDT

Hi I have a requirement which is little bit tedious as of now, can anyone please help me to solve this out.QuerySELECT id,item FROM mytable ORDER BY somefield where id = 5Output:id Item1 poor2 ugly3 evil4 bad5 GodRequired Output:id God1 God2 God3 God4 God5 GodThough it is possible/simple in CTE, SubQuery,JOINs,Derived Tables, but I want this to write in a single query...Thanks in advance.,Prabhu

checkpoint for committed transactions..

Posted: 23 Jul 2013 08:11 AM PDT

HiCan some body say that Is Checkpoint will write pages only from committed transactions...please help me on this.

How to change default port 1433

Posted: 24 Jul 2013 07:53 PM PDT

Hi,One of our Client requests to move away from the default SQL port, if that is port on 1433 Can any one tell me what is the procedure to change the port for sql.what are the steps to follow for the communication between the DB and the application server ?On SQL server 2005 insatnceMany Thanks,

No comments:

Post a Comment

Search This Blog