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

sql server 2012 Logon trigger not working for certain logins

Hello. I created a login trigger to insert data for each login in a table, and it works for all logins except one that is format domain\login and the login ends with the dollar sign(actual name is...

View Article


Image may be NSFW.
Clik here to view.

Join two tables with no matching records

Hi All,I have two tables which have got data as below. Now I need to join those two tables but there are no matching rows or columns in those tables. I have used OUTER JOIN but query was taking more...

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

Which table schema takes up more hard disk space?

Every 15-mins, we have to read the scores of 300 elements, and each element has 400 KPIs. So every 15 minutes, we read 120K scores (300 elements * 400 KPIs).There are two ways of storing this data into...

View Article

Convert or decrypt column data from Binary to String in human readable form

hi every one ,i have a problem and need help. in a table i have a column  State which save binary data like following data. 0x00000000000000 0x00000000000000 0xFFFFFFFFFFFF07 0x0CF5D1977C9603...

View Article


while loop?

I want to see the number of sales each salesperson makes in a month for a year and if they make no sales in any month they are dropped from the list.  I have a while loop that I thought might do this...

View Article

Compare data between two tables of same schema

Folks,I have one very intresting query which i would like to share with you all and looking forward for the solution asap.ScenarioI have two table say TableA and TableB, both having same structre say...

View Article

Complex T-SQL Query

Hello Everyone,I have a table named Measures which has MeasureCode, BeginDate, EndDate and these 3 columns make unique in the table. Along with these columns there is a surrogate key.Ex:- If...

View Article


how to calculate odd and even place digits in SQL?

Hi,I have a field called number-196421744643now i want to pick odd and even place numbers. For example odd place 1+6+2+7+4+4=24 and even place number 9+4+1+4+6+3=27I need this to be calculated for all...

View Article


If the value doesn't exist in a table, query another table. How to do that ?

I am using SQL Server 2012. I have 2 tables, tblA and tblB that have the same columns with different data. Both have columns Symbol and Name. I also have another table, tblC that has a column Symbol.In...

View Article

Split a comma

Hi guys, I'm pratically fighiting with SSIS. I got in a table 100000 rows (string) as 10.36 236.25 56.77 and so on but I got also ( and that's qhy I'm fighting) ten rows as Paris,52.36 Rome,18.22...

View Article

Data Type conversion from LRAW to varchar

Hi ,Can anyone suggest if we can convert a data in LRAW datatype to varchar in SQL.RegardsRajalekshmi

View Article

Example for GetDescendant()

Can anyone give Exmaple for select Query by having  GetDescendant() in where condition.

View Article


Seek a way to identify which databases on different server a user has access to

Hello, I have a stored procedure (invoked by an MS Access front-end) that uses the following to identify the databases that the logged on user has access to:Select name from master.sys.databasesWHERE...

View Article

Image may be NSFW.
Clik here to view.

sqlcmd r: in script not working

I am trying to learn how to use the r: command in SQL scripts and call a main script from SQLCMD using this...

View Article


What does ]] means in syntex.

Hi,below is syntex of commit from http://technet.microsoft.com/en-us/library/ms190295(v=sql.90).aspxCOMMIT { TRAN | TRANSACTION } [ transaction_name | @tran_name_variable ] ] [ ; ]what does ]] means,...

View Article

'row_number' is not a recognized function name.

Pls tell any alternate query for this,SELECTtop2 EventTitle,STUFF(EventDescription,120,4000,'....')AS'Description',GalleryTitle,LEFT(Gallerytitle,(charindex('_',Gallerytitle)-1))as...

View Article


Retrieve File Stored in Database Table

Is there a T-SQL command to extract a file that's been stored in a SQL database table? Specifically, I'm looking to retrieve documents stored in a SSRS Database. Thanks!

View Article

TSQL to add two timr stamps

Hi All,Below is my querySelect [Job Name], (SUBSTRING(run_duration, 1, 2) + ':' + SUBSTRING(run_duration, 3, 2) + ':' + SUBSTRING(run_duration, 5, 2)) AS [Run_Duration(HH:MM:SS)],Convert(Date,Convert...

View Article

T-sql Query Help

I have two tables Table1: MonthTable column: MonthNumbers          1          2          3          4          5          6 Table2: Data Id   Name    Charge   Monthnumber 1     A        200       1 1...

View Article
Browsing all 23857 articles
Browse latest View live


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