Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

switch to current database in SP procedure

Use master go create proc sp_TableCount as select count(*) TableCount from sys.tables where type_desc='USER_TABLE' GO use master exec sp_TableCount use test exec sp_TableCount you always get the...

View Article


RAISEERROR not shown in Agent Job Log File Viewer

I use a RAISEERROR for a critical error in a CATCH. When the Job is run, it does fail but it gives the following message. How do i get my @Note to show in the Log File Viewer? Also, where is the log...

View Article


How can I see the commit time stamp for a transaction?

I’m looking to see if there is any way to tell, through a select, when a transaction was committed?  I know you can get the transaction id by selecting the sys.dm_tran_current_transaction within a...

View Article

Hi Shanky , pls help out regading Profiler Trace issue ?

Hi Shanky, Pls help out . Regadng Profiler Trace . Thanks Vijay

View Article

Script to rename all views in a database

Hi guys,Does anyone has a script in handy to rename all the existing views  in a database .Thanks in advance

View Article


Stored procedure with ORDER BY and results to DataTable

I Don't need the result as a bound data for what I'm needing to do here.I have a datatable created by using a SQL stored procedure, and am using the code below to verify Product data. The stored...

View Article

Data Validation

I have several data validation rules i would like to apply to a stored procedure.For example If (select count(*) from table where (namel is not null or namel <> '') and (namef is null or namef =...

View Article

how to change the default SQL Time zone to GMT -03:00

Hi all,when I use the query select getdate() I have the correct time, when I use the query select getutcdate(), the result is 2 hours more thant current time in Brazil.How to change the time zone on...

View Article


Need assistance with stored procedure

Hello - I would like to ask for some assistance or examples of similar queries to get started on a stored procedure that I need to create.I have developed an application for a repair floor that tracks...

View Article


How do update only the column that was updated?

hi friends, I have the following table structure of an Employee tableColumn Name type ============================= EmpID int EmpFirstName char(20) EmpLastName char(20) DOB Datetime AddressL1 char(100)...

View Article

shredding a table value returned from a udf

Hi.  We run 2012 enterprise.  If I return a table from a udf, and wish to select from it joining on perhaps the pk returned by the query from which the udf was called, thus generating a one to many...

View Article

Image may be NSFW.
Clik here to view.

Prioritize values for same column query

Hi all:SQL08-I am having a hard time wrapping my head around how to solve this issue. I have some temp tables that are created in a proc from a series of queries that match up a customer to an order...

View Article

PIVOT Rows to Columns based on dates with uneven amounts of rows and columns

I have looked through TechNet and SQL Server Central for a good way to pivot a difficult table. So far, the many different approaches have failed and I need a fresh perspective and help with the code.I...

View Article


DBCC SHRINKFILE: Page could not be moved because it is a work table page.

tempdb is auto grown to max size and when i try to shrink below is the error its throwing can anyone help on this DBCC SHRINKFILE: Page could not be moved because it is a work table page.i try to clear...

View Article

Insert Auto Incremented Values in Primary Key Field

Hi ALL ,I have a customer table with 3 fields CustomerID , Customer First Name and Customer Last Name .It already contains some data the Customer ID is a primary key and i need to insert some records...

View Article


Comparing Current and Previous record values based on compound identifier

I am trying to compare the current and previous record values of a set of records based on a compound identifier. This is a learning thing. I am just snapshotting configuration data into the...

View Article

any improvements in how verbose rank function is in 2012?

Hi.  Has there been any improvement in the 2012 rank function syntax?   Our queries are often twice as long as anybody wants to look at when most of the columns are used in the partition by clause and...

View Article


Union multiple tables dynamically based on lookuptable

Hi All,I have few table in my DB named info_1,info_2,info_3,info_4 and there is lookuptable named main_info.Main_info table containsID    Startdate              EndDate1     12/16/2013-00:00...

View Article

Loop through month and year till date while using a merge statement

Hello Guys,I have 2 tables with the following datas in them:-CompanyCompanyId CompanyName1                 Company12                 Company23                 Company3EmployeesEmployeeId EmployeeName...

View Article

Query a table

AccountID        ContactName     ContactCity      ReachByPhone      LastContactDate     DecisionType001234xx              Sean                    Chicago                Yes...

View Article
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>