sorting tables
What different ways could you sort a list of data into a specific order, i.e.:Smallest to largest? Cheapest and most expensive by group?sukai
View ArticleCreating a new database using an MDF file
My database saves as MDF. I want to know what are the steps to restore or create a new database using a MDF file? I tried to restore as usual but it shows an error. Please help.
View ArticleHow to Avoid Redundant Indexes on Indexed Views
Let's say I have an indexed view - so far it only has a clustered index. I want to avoid redundant indexes. So let's say the view joins Customers and Orders. If I've already put a nonclustered index on...
View ArticleSyntax question - columns noted in parentheses?
I found this query somewhere on the web, copied it to my notebook but part of it I never understood - why the two columns in parentheses? What does that accomplish?select x.employeeid, y.thecount...
View ArticleIndex job failed with this error Msg 1222, Lock request time out period...
HI All,I am using Ola index optimization for rebuild\reorganise indexes and update stats. but it is failing continuously with this error.Msg 1222, Lock request time out period exceeded. [SQLSTATE...
View ArticleHow to write procedure or SQL select query
Hello AllI want to make procedure or select query where same PID(Permanent ID) admitted to the hospital at different date. If the date difference(day) is equal 7 days then 1 and it will search next...
View ArticleHow to email result of a select from SQL
Hi All,Our application does not have notification feature when certain customers missed their payments. Is it possible to schedule a job in SQL server to send an email to the account manager when ever...
View ArticleHow to merge 3 different query results using full outer join?
Hi all This is my my query for 2 resultswith t1 as ( select trans.crAcc_id,trans.cr_amt,row_number() over (order by trans.head_id) rn from Acttrans trans, Acttranhead head where trans.head_id...
View ArticleLogin failed for user
I have a SharePoint server which is using service account "spsharepoint".For some reason this user has started giving 'Login failed for user spsharepoint' when I checked SQL Server logs. Turns out it...
View Articledoes non clustered index contain clustered index
hi all, i want to create a non clustered-index(say cover index) for the below queryQuestion : does non clustered index contain clustered index, please let me know which index would be the bestCREATE...
View Articlefile growth settings basics
I am pretty new to MSSQL (not a DBA), and trying to understand the basics of filegrowth settings. None of the databases have a max size set, so presumably they will keep growing as long as their is...
View Articlesys.database_files
How can you convert the "size" value of the database in sys.database_files into GB? (unsure what size metric it is currently stored as).
View ArticleFetching data based on parent_id recursively
Following is the sampletable:FolderIDFolderNameParentID 1 Fruit NULL 2 Vegetables NULL 3 Meats NULL 4 Spices NULL 5 Apples 1 6 Granny Smith 5 7 Golden Delicious 5 8 Fuji 5 9 Pink Lady 5 10 Oranges 1 11...
View ArticleUse a cursor to insert unique field into table
I have never used a cursor before so I am new to this. I'm wondering if someone could point me in the right direction.I have a table in my database that already contains some data. There are only 5...
View ArticleSlow connection
Hi Guys – I’d like to ask a quick question: We have a domain network and we are experiencing a slow data transfer. In other words what took 0.8 sec to return, it takes 5 sec. This happens when the...
View Articleis there a utility or a simple import a few columns from a flat file onto a...
I have a big flat file of over 2600 columns; but I only want to import columns 40 to 49 onto a sql table.Could you please advise what should I do.Thanks,Sally
View ArticleSQL Server only using 4 out of 6 cores
Hi,I noticed that SQL server only appears to be using 4 out of 6 cores.I was doing a bit of reading around this and I think the solution may be to change some of the processor affinity settings. Has...
View Articleblank password for sa user in SQL server
i have already checked and confirmed that checkboxes in the SA login properties does not have a tick mark and also saved the properties window after leaving the password blankbut when I'm unable to...
View ArticleHow can I reduce the size of my DB and my nightly backups?
One of my SQL databases is growing out of control and its required nightly backups (FULL) are sucking disk space at a rapid rate. The backups are now at 120GB a pop and the DB itself is somewhere at...
View Article