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

Filter Data by Hour

Good Morning!I have a query that gathers all the sales data for the day. There is a column on the SalesEntries table (SalesEntries.TimeStamp) that denotes the time the sale was finalized.I need help on...

View Article


Create a table with

HiNeed to get a script to create only the structure of a table including the two following fields :field1 (int) and field2 (varchar) Field1 will be incremented based on the field2 value it means when...

View Article


SQL Server data change and Security

in our environ any user who login with sa they can change any table data.so i write trigger to capture changed data like who change, from which IP etc thisCREATETRIGGER[TRG_Users]ON[dbo].[UserRights]...

View Article

batchstarting is not fired.

Hi,When I kick-offed a query, I didn't see the  batchstarting show up in sql profiler in my QA server until I cancelled query. However if my moved the same query to DEV or production, I could see the...

View Article

How to handle sp_executesql input parameter limitations.

How can we handle the issue where we have lots of input parameter with varchar(max) in dynamic SQL, using execute sp_executesql command?  We have more than 20 varchar(max) input parameters to stored...

View Article


LEFT JOIN

Hi all,        sometimes my mind thinks lot of things and misses small logics.. simple but not able to concentrate help is appreciated..Create table #sample ( text varchar(10) ,id int ) insert into...

View Article

how to update table

Environment: SQL Server 2008 R2Intro: StagingTable consists of three fields:  order_dt, SSN, Score. I also have another database object called dbo.badData which has the following order_dt , SSN, score,...

View Article

Image may be NSFW.
Clik here to view.

how can I fill the blank space in the example below?

I have to fill using sql statement the blank space with the same description that appears below that belong to the same STTCKT. I am using a temporary table.

View Article


Insert into a temp table is to slow

i'd like to know why if i created a temp table out of my procedure the insert into it get slower than if i create that temp table inside my procedure. follows an example:createtable#Test (col1...

View Article


Hierarchy challenge: employee reports-to info, use an employee's manager if...

My experience level is not that high with SQL so please be gentle...I am obtaining info for an employee including the employee's supervisor.  This is pretty straightforward except that sometimes the...

View Article

Regarding sql server notification service

i never use sql server notification service. so i like to know what it does. does it notify when data changed? suppose i have one win apps by which our employee insert/update/delete data. i want that...

View Article

Parsing Error in Refresh script

I*'ve got a refresh script I came across and was adjusting to suit our environment. There seems to be something missing as I get the following error while parsing the sql script"Msg 137, Level 15,...

View Article

TVP Performance with high volume...

I have .NET application that passes parameters to a stored procedure. One of the parameters is a table valued parameter(TVP) which is with wider width in terms of number of columns and also it may...

View Article


Join on Large Table

I have some queries that use an inner join between a table with a few hundred rows and a table that will eventually have many millions of rows. The join is on an integer value that is part of the...

View Article

Conversion failed when converting date and/or time from character string.

I am having this error when I try to add data on this query.Is there anything wrong, and which should be correct solution? Create Table TB_ENTUserAccount (ENTUserAccountID Int Primary Key,...

View Article


Split two data into table

in stored procedure have query like this :declare@col1_list varchar(max),@col2_list varchar(max)declare@tbl TABLE(col1 int , col2 int)set@col1_list ='2|6|7|4|3|'set@col2_list ='1|' want split data...

View Article

Image may be NSFW.
Clik here to view.

Select statement to get all data with the same column value

i have created a page for user to search the sql server.. the search page has 2 dropdown, one is the Entity dropdown containing all the entity_ID in SQL server the other is Business Unit Dropdown which...

View Article


List of all dates where Day is Sunday

Hi,I would like to ask ow can I have SQL to list all dates from given_date to max_date but only the dates which week day is Sunday.I want to use it to loop and do an insert within the loopThanks,Jassim

View Article

How to maintain previous and record count in audit table in SQL Server 2008 r2?

Hi Experts , Situation : in our database we are having few of stored procedures which will drop and recreates the tables and it is scheduled on weekly basis. when this job will run all the stored...

View Article

Count Aggregation

Hi ALL ,I have a view  that results in the below Output which is based of a very complex length query : Action LengthMinutes ADD 37 ADD 37 ADD 25 Delete 1 COPY 1 COPY 3 COPY 1 CUT 2 ADD 24 ADD 37 ADD...

View Article
Browsing all 23857 articles
Browse latest View live


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