Can this happen?
Env : SQL Server 2008 R2This is my SPBEGIN TRANSACTION; BEGIN TRY Delete...from my table(say TABLE1) If all records has been deleted from TABLE1 Begin Insert......TABLE1...
View ArticleSubtract and Sum in SQL
declare @a float set @a = 100 select @acreate table #t (id int, colA int, colB INT ) insert into #t select 1,2,4 union select 2,4,3 union select 3,3,2 union select 4,5,4 union select 5,8,1SELECT *...
View ArticleProblem getting 2 duped records.
SELECT User.LastName, User.FirstName, User.Middle, User.BirthDate, User.ID, Research.ResearchDateTime, Report.ResearchTag, Research.UserTag, Research.ResearchID, ReportSnapshot.ScientistTag,...
View ArticlePerformance tuning help needed..long running query
Hello Guys,The following is a long running query where am doing lot of aggregation:SELECT STG_HOLDINGS.ACCNT_NUM, sum(cast(STG_HOLDINGS.SHARES_PER_VAL_QTY as decimal(22,7))),...
View ArticleHow to check TSQL's EXECUTE command for error
Hello,I am TOTALLY new with TSQL/SQL. consider the code below:EXECUTE sp_executesql @sql, N'@xmldataOUT xml OUTPUT', @xmldataOUT=@instance OUTPUT;CREATE XML SCHEMA COLLECTION FASSchema AS @instanceHow...
View ArticleAutomatic DataGridView update AddWithValue
Hello guys, I have this code which does: Automatically updates changes in datagridview I need it to: As I don't have column named "akce" in datagridview I need it to automatically insert to every new...
View Articlewhat datatype to use
Hi,what datatype should I use which as data like hyperlink or Picture and for data like Percentage?Thanks
View ArticleWhat does MS T-SQL include that MS SQL doesn't
My question is this:Is the only difference between MS T-SQL and MS SQL is that MS T-SQL can handle transactions? If so, how much is there to moving to T-SQL from SQL, is there a lot to transactions?...
View ArticleFull log disk, cannot cancel query
hello, on production database, I try to do a query that I know will take much time/log, but my estimations where wrong, so the log disk were full, no error displayed on screen or rollback... so I wait...
View ArticleUse Computed Column as Primary Key
I am trying to make my computed column (QuoteID) the primary key. QuoteID is a concatenation of two fields as you can see below. Below is how SQL Server 2008 scripts the CREATE TABLE without QuoteID...
View Articlemsg 207, Invalid column name, sql 2008
hi every bodycould you please tell me what is the below problem?!SELECT [customer-grp].name as [group] ,[city-customer].name as city, customer.pk, customer.name as customer , customer.[address]...
View ArticleIncorrect syntax near the keyword 'FILE'
I am trying to move SQL Server 2008 system data bases to a new location.Here is the code I am using for the first step:USE master GO --ALTER temdb ALTER DATABASEMODIFY FILE (NAME = 'tempdev',FILENAME =...
View ArticlePowershell invoke-sqlcmd calls stored procedure second time after Query...
We have a very strange issue. We have noticed that a single stored procedure is executed twice when is called by Powershell invoke-sqlcmd command.When we trace it we can see the procedure starts...
View ArticleCreate a mailing list for Data Driven subscriptions
Hi All,I am sort of struggling a bit to create a emailing list which will then be used in my data driven subscriptions.My actual requirement is run a sales report and then email out to Sales Managers...
View ArticleCopying 'semanticsdb' (SQL semantic language statistics database) between...
Dear all,Microsoft SQL 2012 comes with semantic search features. In order to use them, one must attach a separate database called 'semanticsdb' to SQL server, containing semantic language statistics...
View ArticleNeed help putting a query together to detrimine Unit Cost
I need help putting together a query to calculate Unit Cost. Unit Cost formula is (Volume of completed work divided by DNIE (Direct Non-Interest Expense ))Volume of complete work is in two tables and...
View ArticleSQL SELECT. Carriage Return generation
I need to generate an email report for a customer using T-SQL. The report needs to be in the formatField1Field2Field3Field1Field2Field3Can I use SELECT from a table to do this?Thanks
View ArticleAppending 0 if length < 2
Hi,I am doing some manipulation on the string such that if i was given 2 characters, I will prefix it with "0". If it's 2 characters, no manipulation is done.Currently I am doing RIGHT("0" +...
View ArticleODBC or OLEDB
i heard from sqlapi that "preferably to use ODBC because Microsoft says about the migration to ODBC API as default for any new SQLServer versions." and is that true?
View ArticleStuck convert string to date in MSSQL
How to convert string to datetime in sqlserver ? I have date time 13072013, and i want to convert it to 2013-07-13CONVERT(DATETIME,'13072013', 112) How to do that ? Regards,
View Article